keeping background service alive after user exit app

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.


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值