您的位置:首页 > 移动开发

keeping background service alive after user exit app

2015-12-11 14:47 537 查看
http://stackoverflow.com/questions/17767767/keeping-background-service-alive-after-user-exit-app?rq=1

I'm trying to create some service that will do background jobs for me even after the user closed the app from the running processes menu(by shifting process up the screen). I'm not sure if it even possible, so maybe this question is irrelevant.

What I tried to do is create service in a different process by declaring it like this:
<service
android:name=".service.Service"
android:enabled="true"
android:icon="@drawable/ic_launcher"
android:process=":my_process" >
</service>


and the onStartCommand() is:
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
return START_STICKY;
}


I hope I provided enough info.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: