Search code examples
androidandroid-4.0-ice-cream-sandwichnexus-s

Nexus opens same app twice when using custom URL to launch the app


My app has the feature of being launched from the browser if the user clicks on a particular type of URL. This thing works well on any android phones except the Google Nexus having ICS. With Nexus, when I click on a URL which can open my app, the app opens properly, but if i go to home screen and click on the app icon, even that opens up. So now I can see my app opened in the browser app as well as my own app, simultaneously. I saw the same behavior with other apps too. like the play store or twitter. Wondering if this is okay or can cause some issues.


Solution

  • It should be considered indifferent, neither OK nor bad - however, you could always make use of the Activity available via the AndroidManifest.xml so that you only keep one instance of the given Activity available.

    Parameters on the <activity /> level in the manifest:

    android:launchMode="singleTask"
    <!-- OR -->
    android:launchMode="singleInstance"