Resume the application (activity) upon receipt of an intent when the activity is enabled.

Here are my scripts:

  • User opens the application and uses it => the application is on one of their screens
  • User moves the app in the background with the Home key
  • The user starts browsing and views my site. Through the website, certain links open the application.
  • The user clicks on the link in the browser and the application starts BUT even if the activity is enabled it doesn't resume but starts over and over, so the current session is lost.

My main action is to use the target filter data, so I added:

  <activity android:name=".HomeActivity"
            <intent-filter>
                <data android:scheme="myprop" />
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
            </intent-filter>
  </activity>

      

so when the user clicks a custom url in the browser my app wakes up and starts its activity. As I said, if mine HomeActivity

is - onPause

(which means the user has already used it), is it possible to just resume it (and parse myprop parameters of course) while keeping the current user progress?

+3


source to share


1 answer


You need to define the launch mode of your activity per instance. To do this, update your activity in your android manifest:android:launchMode="singleInstance"



After that, your existing activity will be opened and you will receive a callback for Activity.onNewIntent(Intent intent)

+3


source







All Articles