被杀死后如何自动重启服务?

编程入门 行业动态 更新时间:2024-10-12 01:23:11
本文介绍了被杀死后如何自动重启服务?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我已经有很多关于该主题的帖子,其中一些作品,但仅在某些设备上.例如,它可以在带有cyaogenmod的Nexus 4,Nexus 5上运行,但不能在我的Xiaomi Mi2s(果冻束4.1.1)上运行

I have already red many posts about the subject, some of these works, but only on some devices. For example it works on my Nexus 4, Nexus 5 with cyaogenmod, but not on my Xiaomi Mi2s (jelly beam 4.1.1)

我尝试将其设置为粘滞状态,使用警报,并在销毁时广播接收器.但是他们俩都没有解决.当我终止该应用程序时,它再也不会唤醒.但是在同一台设备上,Whatsapp可以完美运行,即使我将其杀死,它也会再次唤醒.

I tried setting it sticky, using alarm, and broadcast receiver on destroy. But neither of them worked out. When I kill the application it never wake up again. But on the same device Whatsapp works perfectly, and even if I kill it, it wake up again..

有没有不用GCM的方法吗?

Is there any way to do it without use GCM?

我已经查找了一些链接:

Some of the link I already looked up:

如何自动重启被终止的服务?

重复运行方法,经过一段时间

stackoverflow/a/21551045/627307

推荐答案

我不确定它是否能为您解决问题,但对我有用.

I'm not sure if it will solve the issue for you or not but it worked for me.

我正在运行MIUI 6.6.10

I'm running MIUI 6.6.10

  • 打开小米提供的安全应用

    单击权限->自动启动

    此处允许您的应用自动启动

    Here allow your app to auto start

    WhatsApp和所有著名应用程序都可以工作,因为小米白列出了它们并允许它们自动启动.

    WhatsApp and all famous apps work because Xiaomi white listed them and allowed them to autostart.

  • 更多推荐

    被杀死后如何自动重启服务?

    本文发布于:2023-11-27 13:21:56,感谢您对本站的认可!
    本文链接:https://www.elefans.com/category/jswz/34/1638248.html
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:死后   被杀   自动重启

    发布评论

    评论列表 (有 0 条评论)
    草根站长

    >www.elefans.com

    编程频道|电子爱好者 - 技术资讯及电子产品介绍!