Reputation: 393
I have app A that interacts with app B. When I launched app B using startActivityForResult
, app A creates an instance of app B. While the actual app B can still be launched manually.
Is it possible to launch app B using startActivityForResult
, but this time brings the actual app B to foreground?
Activity declaration on App B's Manifest:
<activity
android:name=".activities.AppBActivity"
android:launchMode="singleTask"
android:screenOrientation="sensorPortrait"
android:theme="@style/Theme.AppCompat.NoActionBar" >
<intent-filter>
<action android:name="intent.action.ApplicationBActivity" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="appBHost"
android:scheme="appBScheme" />
</intent-filter>
</activity>
Application A launching B.
Intent launchAppB = new Intent(appBCustomAction, Uri.parse(schemeAndHost));
startActivityForResult(launchAppB, LAUNCH_APP_B_REQUEST);
Upvotes: 1
Views: 587