后强行停止重新启动服务 [英] Restart service after force stop

查看:307
本文介绍了后强行停止重新启动服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在开发的用作应用程序更衣室的应用程序,一个应用程序能够通过要求用户输入密码的开扩这些应用程序,以保护其他intstalled应用程序,我的应用程序的这里

这个问题是可以通过武力轻易跳过的应用程序从Android任务管理器关闭它,我怎么能解决这个问题,

还拿什么来检查新的应用程序打开时,要进行哪些检查每一个一秒钟的应用程序在任务顶部的服务或火灾报警经理每一秒的报警做出检查,

在等待您的帮助,

奥马尔

解决方案

更新:

 重新启动后生效一站式服务
 

答:对不起,你不能重新启动它,直到用户手动启动应用程序

假设您的服务正在运行的进程的一部分,如果用户强制停止的过程中,你是从的永远的重新运行该服务,直到用户的手动pvented $ P $ 启动你。这是尤其是从 3.0合法及以上版本(检查你的)。这也似乎是合乎逻辑,当你认为有一个应用程序,这使服务启动所有的时间,很讨厌在某些方面的用户。因此,当用户订购的应用程序命中(:)力站),它的不应该重新启动服务,继续窃听用户。

例如,试想一下,如果你能会发生什么创建一个刚吃了你的处理器时间由持有唤醒锁的应用程序,你不能杀了他们。这将是可怕的,一个巨大的安全灾难。

所以,您不会可以通过任何手段,直到用户推出的活动之一,重新启动您的服务。

你也不能禁用强制停止按钮AFAIK。你应该采取的观点,没有什么设备上的是你,除了你的应用程序和(在有限的范围内)的资源,而你允许访问控制。

Finnally,甚至Gtalk的应用程序会屈服于你的意志,如果您希望强制停止。当您使用的使用Gtalk的服务,如PUSH的Gmail(手机,其中每增加心不是固件的一部分)的Gtalk或其他应用程序它才会开始。

解决方法:

<一个href="http://stackoverflow.com/a/11238779/1218762">http://stackoverflow.com/a/11238779/1218762

I am developing an application which is used as application locker, an app which is able to protect other intstalled apps by asking the user for a password on openning those apps, my app is here

the problem is that the application can be easily skipped by force close it from the android task manager , how i can overcome this ,

also what is the best way to check for a new application open, to make a service which check every one second for the app on the top of tasks or to fire alarm with alarm manager every second to make the check,

waiting for your help,

Omar

解决方案

Updated :

Restart service after force stop

Answer : Sorry you can't restart it until the user manually launches application.

Assuming that your service is running as part of the process and if the user force-stops your process, you are prevented from ever running the service again until the user manually launches you.This is especially valid from 3.0 and above version ( check for yours). It also seems logical when you think that there is an app which keeps a service started all the time and is annoying the user in some way. So when the user orders a hit ( :) force-stops) on the app, it should not restart the service to continue bugging the user.

For instance, Imagine what would happen if you could create apps which just ate at your processor time by holding a wake lock, and you couldn't kill them. This would be horrible and a huge security disaster.

So, you will not be able to restart your service by any means until the user launches one of your activities.

Also you cannot disable the force-stop button AFAIK. You should take the viewpoint that nothing on the device is yours to control besides your app and (to a limited extent) the resources to which you're granted access.

Finnally, even the gtalk app will bend to your will if you desire to force stop. It will start only when you use Gtalk or other apps which use the gtalk service such as PUSH Gmail ( for phones where gtalk isnt a part of firmware).

Reference Link

Solution :

http://stackoverflow.com/a/11238779/1218762

这篇关于后强行停止重新启动服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆