I created a service class that should run in background.
And it is working well.
The problem is when i remove task from recent panel it restarts and i loose all data stored in my service class.
I tried almost every way available on internet.
Search for a music player named Phonograph
It does just what i want, song keeps playing without any pause even after removing it from overview screen.
Service Class
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
return START_STICKY;
}
Manifest
<service
android:name=".service.MS"
android:enabled="true"
android:process="com.architjn.ms"></service>
-> Don't mark it as duplicate as i already tried previously asked similar questions, non of them worked for me.