2

在文档中,关于为 Google Cloud Messaging 编写 Android 部分,描述了两个不同的选项:

- 使用com.google.android.gcm.GCMRegistrarcom.google.android.gcm.GCMBroadcastReceivercom.google.android.gcm.GCMBaseIntentServicehttp://developer.android.com/google/gcm/gs.html#android-app

- 使用android.content.BroadcastReceiver和+ 在http://developer.android.com/google/gcm/gcm.html#writing_appsandroid.app.IntentService中编写处理程序。

这令人困惑。推荐的方法是什么?

4

2 回答 2

1

-使用

com.google.android.gcm.GCMRegistrar、com.google.android.gcm.GCMBroadcastReceiver 和 com.google.android.gcm.GCMBaseIntentService

http://developer.android.com/google/gcm/gs.html#android-app

在这里工作得很好

于 2013-02-14T10:52:54.647 回答
0

由于我信任 Commonsware,我查看了他的Busy Coder's Guide to Android Development并使用了 com.google.android.gcm.GCM* 类。它们使一切变得更容易(将注册保存到首选项,使用唤醒锁......)。

于 2013-02-14T13:48:28.593 回答