I made myself an app: a music player with automatic bookmarking 🙂
Problem:
If I go “back” to the home page and then try to run the app again, it creates a new instance whereas I want to continue. I might leave music running while I do other things and then I can’t pause it or save it because I can’t access it!
Failed Solutions:
I’ve tried singleTop, singleTask, singleInstance and they all don’t work!
I can view running apps (Settings > Applications > Manage Applications > Running) but it only let’s you “Force stop” them. How about “Bring to front”?! Also, when I finish() my app, I notice it’s still “running”!
This site is very awesome and useful and this is my first question 🙂 I looked for answers but couldn’t find any that worked 🙁
Here’s the manifest:
<application android:icon="@drawable/icon"
android:label="@string/app_name">
<activity android:name="Fire"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:launchMode="singleTop">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Back by default closes the activity. You can override this behaviour by catching BACK key, but in your case, you really need Service not activity to play music and control it. Activity is ment to be destroyed when you leave it on BACK really….
Read more here: http://developer.android.com/guide/topics/fundamentals/services.html