Android Question How can I simply bring my app to the foreground from a link in a webpage without specifying a specific activty?

JohnC

Expert
Licensed User
Longtime User
I want to sort of do deeplinking, but I don't want the link in a webpage to open a specific activity in my app - I just want the link to either:
  1. Start my app if it wasn't already started, or
  2. Simply bring my app to the foreground regardless of what activity was being displayed before the app was paused.
But it seems all deeplink examples require the intent filter to specify a particular activity, and that activity will be displayed when the link is clicked regardless of the state of the app before the link was clicked.

Any ideas?
 
If you are using B4xPages, there is only one activity and that will be the one started. So the app will start.

Normally you would then check the intent to find out why your app was started but in the case you describe, that should be enough.
 
Upvote 1
Thanks for the reply.

This is a huge app written in non-B4xpages, so it's not practical to rewrite it.
 
Upvote 0
The same applies set the Intent filter on Main and the app will start.

B4X: Copy
AddActivityText(Main,
<intent-filter>
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.DEFAULT"></category>
    <category android:name="android.intent.category.BROWSABLE"></category>
    <data android:scheme="myintent" />
    <data android:host="myintent.host" />
</intent-filter> )
 
Upvote 0
But won't that display the main activity even if the app was displaying another activity before it was paused?
 
Upvote 0
Thanks, I was hoping I didnt have to do that.
 
Upvote 0
Back
Top