I don't know how to tackle this Android issue. In few words, the flow between my 2 applications is as below :
I want to create a task with the below components :
I tried to change the BillingActivity + PaymentActivity "launchMode" :
singleInstance
A new task is created for both of them. When pressing return button (or calling finish() method), user is redirected as expected to the previous activity. Problem: "StartActivityForResult" cannot be use between multiple tasks (onActivityResult is called immediately ).
SingleTask
When pressing return button (or calling finish() method) in BillingActivity, user is redirected to the Top2Activity (which was in the background task).
I 've lost more than 48 hours trying to solve it. I would appreciate your help. I can post code if needed.
Thank you
----------- EDIT 2015-02-02
Following the advice of David, i removed all special launch modes :
TOP2Activity(background):
<activity
android:name=".activities.MainActivity"
android:configChanges="orientation|keyboardHidden"
android:label="@string/title_activity_main"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateAlwaysHidden|adjustPan" >
<meta-data
android:name="android.app.searchable"
android:resource="@xml/searchable" />
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="xxx" />
<data android:host="xxx" />
</intent-filter>
</activity>
My Top1Activity(Foreground):
<activity
android:name="activities.MainActivity"
android:label="@string/app_name"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
BillingActivity(Foreground):
<activity
android:name=".activities.BillingActivity"
android:configChanges="orientation|keyboardHidden"
android:excludeFromRecents="true"
android:label="@string/title_activity_billing"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.VIEW" />
</intent-filter>
</activity>
PaymentActivity:
<activity
android:name=".activities.PaymentActivity"
android:configChanges="orientation|keyboardHidden"
android:label="@string/title_activity_payment"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateHidden" >
</activity>
AIDL Service returning pendingIntent:
Intent intent = new Intent();
intent.setClass(InBillingService.this, jp.xxx.activities.BillingActivity.class);
intent.putExtra(Consts.PENDING_INTENT_INFO, result);
intent.putExtra(Consts.RESULT_KEY, nextSession);
PendingIntent pendingIntent;
pendingIntent = PendingIntent.getActivity(InBillingService.this, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
bundle.putParcelable(Consts.PENDING_INTENT, pendingIntent);
When pressing back button from BillingActivity (or PaymentActivity), I am still redirected to the Top2Activity...
No idea ? Thank you
Add android:taskAffinity=""
to the <activity> defninitions for both
BillingActivityand
PaymentActivity`.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With