即使我强行停止应用程序吗

即使我强行停止应用程序吗

本文介绍了如何WhatsApp的服务被重新启动,即使我强行停止应用程序吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行的WhatsApp(我们可以称之为APPX从现在起)的设备A.我去管理应用程序 - 关闭>力,使APPX被关闭,我再也看不到APPX为运行服务

现在,5分钟后,我把从另一个设备的APPX(设备B)到设备中的APPX(我们把它打死了一个)的消息。  这里有2个场景我测试:

  • 与Android 2.1设备中的:它从来没有收到该消息,因此我们可以说,没有APPX服务得到了重新启动。它仅接收消息,如果手工用户重新启动应用程序。

  • 采用Android 2.3.6设备答:一些神奇的原因,无论多久它已经从APPX被杀了,只要我们发送消息从设备B - >装置A收到消息,因此, APPX公司的服务被重新启动。注意:所有的APPX被关闭,并没有收到任何通知的时候,我没能看到APPX任何正在运行的服务管理应用程序,所以这意味着,这种神奇的服务得到尽快收到消息/通知重新启动

我知道这听起​​来有些不可思议,而且很多人会说这是不可能的,但同样,这已经过测试的这两个设备。

我试图做到这一点相同的行为,所以任何帮助将AP preciated吧。

解决方案

我不认为这是一些神奇这里发生的事情!这只是Android的C2DM(参见: https://developers.google.com/android/c2dm/),而应用程序有一个注册接收传入的推送通知,并得到此消息唤醒。Android的C2DM是/是可利用的Andr​​oid 2.2系统,这就是为什么你不能看到相同的行为在设备上使用Android 2.1的启动和运行的原因。

顺便说一句:正如你所看到的,C2DM是自6月26日,2012年。因此,而不是C2DM的pcated德$ P $,应使用GCM(见的 http://developer.android.com/guide/google/gcm/gs.html

有用的注释:GCM需要提供互联网连接。可以使用任何其他的广播接收器,例如SMSReceiver为通过使此限制。

I am running whatsapp (we could call it appX from now on) in device A. I go to manage applications -> force close so appX gets closed and i no longer see appX as running services.

Now, after 5 minutes, I send a message from another device 's appX (device B) to device A appX (the one we killed it). Here are the 2 scenarios i tested :

  • device A with android 2.1 : it never receives the message, therefore we could say that none of appX services got restarted. It ONLY receives the message if manually the user restarts the app.

  • device A with android 2.3.6 : for SOME magic reason, no matter how long it's been since appX got killed, as soon as we send the message from device B -> device A gets the message, therefore, appX's service gets restarted. Note : all the time that appX was closed and WITHOUT receiving any notification, i wasn't able to see any running services of appX in manage applications, so this means that this magic service gets restarted as soon as it receives a message/notification

I know it sounds weird, and lot of people will say this is impossible, but again, this has been tested on these 2 devices.

I am trying to accomplish this same behavior, so any help will be appreciated it.

解决方案

I don't think it's some magic what happens here! It's just Android C2DM (see: https://developers.google.com/android/c2dm/), whereas the app has a registered Receiver for incoming Push Notifications and gets awaken by this message.Android C2DM is/was available with Android 2.2, that's the reason why you can't see the same behaviour on your device with Android 2.1 up and running.

By the way: As you can see, C2DM is deprecated since June 26th, 2012. So instead of C2DM, one should use GCM (see: http://developer.android.com/guide/google/gcm/gs.html)

Useful Comment: GCM needs available internet connection. You can using any other broadcast receiver such as SMSReceiver for by passing this limitation.

这篇关于如何WhatsApp的服务被重新启动,即使我强行停止应用程序吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-21 17:44