Application quit without ending other activities on Android

I had build a Android game using Unity3D, and I added an Advertisement SDK into my game by integrating Eclipse with Unity3D, the SDK required several activities, services and receiver which are declared in Androidmanifest.xml.

The Advertisement activities needs to run after my game is quit.

Now the problem is, when the UnityPlayer.Quit() is called, it seems every activities associated is shut down by unity.

To solve this, I change UnityPlayer.Quit() which is called in onDestroy() to this.finish(), but another problem comes. When I open my game again, it just closed immediate, and I have to open it once again to start it normally.

Can anyone tell me how to solve this?

Thanks!

You could try run it in background.
File > Build Settings> Player Settings > Click the downwards arrow button > Run in background.

This might work for you.

According to Google, you can have multiple apps which share data between each other if they share a Key. You could in theory use this to your advantage if you use a silent install for the AD network nonsense :slight_smile: I’m quite sure its been done before.

Old question but I stumble upon this issue recently and solved it by specifying a different process name (f.i. “:unity”) for the UnityPlayerActivity in the Android Manifest. It seems UnityPlayer kills its process when quit() is called so you just have to be sure your Application and other Activities have a different process name (by default it’s the Application package name).

See http://developer.android.com/guide/topics/manifest/activity-element.html#proc for more info.