Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to handle android child activity not finishing
    primarykey
    data
    text
    <p>I've got an Android app that I want other apps to be able to launch via an intent. This allows other apps to interact with mine and provide initial inputs etc.</p> <p>The calling App (call it App-A) does the following:</p> <pre><code>Intent intent = new Intent("com.myapp.dosomething"); intent.putExtra("com.myapp.value1", "1.25"); intent.putExtra("com.myapp.value2", "bob"); startActivity(intent); </code></pre> <p>My activity is started with the intent filter:</p> <pre><code>&lt;intent-filter&gt; &lt;action android:name="com.myapp.dosomething" /&gt; &lt;category android:name="android.intent.category.DEFAULT" /&gt; &lt;/intent-filter&gt; </code></pre> <p>Everything works fine if the user goes through the normal flow of my app. The user does stuff and then when I know the user is done I call finish() on my activity. Everything is dandy.</p> <p>However, if part way through doing stuff in my app the user hits the home button instead of finishing the task we end up with a major problem. If they try and restart App-A from the launcher my app pops up instead. The user can never get back to App-A without force killing my app. Even worse, my app is specifically designed to not retain any data between launches and when re-launched in this way it also doesn't get any of the extra data originally passed in so my app has no way to know that this other app is still waiting on mine.</p> <p>How do I set things up so that App-A doesn't sit there waiting on my app? It should be able to continue running regardless of what my app does. If my app crashes, or doesn't return a value I don't want the calling app to be hung forever.</p> <p>Any ideas?</p> <p>Thanks.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload