Reputation: 14066
I have a chat app, that is uses one thread for the socket. My probleme is: after I going to background, sometimes the app is killed my the launcher in phones.
On TABLETs every background/foreground operation has a "app died, killed by launcher"
How can I solve this?
UPDATE:
<activity android:name=".ChatStart"
android:label="@string/app_name"
android:launchMode="singleTop"
android:configChanges="orientation|keyboardHidden"
android:screenOrientation="landscape"
android:windowSoftInputMode="stateHidden|adjustPan"
android:theme="@android:style/Theme.NoTitleBar"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
How can I rewrite it as a Service? Is it an easy way to do it only in the manifest?
thanks, Leslie
Upvotes: 0
Views: 1409
Reputation: 15619
When your app is in the background, Android may terminate it anytime it sees fit. Usually this happens when there is a need for memory, i.e. when other programs are started.
To keep Android from automatically terminating your app you need a service. Using a service makes it a lot less likely (but not impossible) for Android to kill your process when it needs the memory.
Upvotes: 3