即使我强制停止应用程序,whatsapp 服务如何重新启动? [英] how does whatsapp service gets restarted even if i force stop app?

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

问题描述

我正在设备 A 中运行 whatsapp(从现在开始我们可以称其为 appX).我去管理应用程序 -> 强制关闭以便 appX 关闭,我不再将 appX 视为正在运行的服务.

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.

现在,5 分钟后,我从另一台设备的 appX(设备 B)向设备 A appX(我们杀死它的那个)发送了一条消息.这是我测试的 2 个场景:

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 :

  • 带有 android 2.1 的设备 A:它永远不会收到消息,因此我们可以说没有任何 appX 服务重新启动.如果用户手动重新启动应用程序,它只会收到消息.

  • 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.

带有 android 2.3.6 的设备 A:出于某种神奇的原因,无论 appX 被杀死已有多久,只要我们从设备 B 发送消息 -> 设备 A 收到消息,因此,appX 的服务重新启动.注意:一直关闭 appX 并且没有收到任何通知,我无法在管理应用程序中看到任何正在运行的 appX 服务,因此这意味着一旦收到消息/通知,这个神奇的服务就会重新启动

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.

推荐答案

在您对该答案投赞成票/反对票之前,请考虑到答案现在快 3 岁了(说到 2015 年 5 月),事情可能会变了!

Before you up/down-vote this answer please take into account that the answer is nearly 3 years old now (speaking of May 2015) and things may have changed!

我不认为这里发生的事情有什么神奇之处!这只是 Android C2DM(请参阅:https://developers.google.com/android/c2dm/),而应用程序有一个已注册的 Receiver 用于传入的推送通知,并被此消息唤醒.Android C2DM 在 Android 2.2 中可用/曾经可用,这就是为什么您无法在启动并运行 Android 2.1 的设备上看到相同行为的原因.

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.

顺便说一句:如您所见,C2DM 自 2012 年 6 月 26 日起已弃用.因此,不应使用 C2DM,而应使用 GCM(请参阅:http://developer.android.com/guide/google/gcm/gs.html)

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)

有用的评论:GCM 需要可用的互联网连接.通过传递此限制,您可以使用任何其他广播接收器,例如 SMSReceiver.

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

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

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