我正在尝试在我的项目中实现gcm,因为我想创建设备到设备消息传递应用程序
我在这里阅读http://developer.android.com/google/gcm/client.html,因为它建议从http://code.google.com/p/gcm网站下载源代码
但是当我下载了代码时,我发现的类已经被弃用,下面是类代码
public class DemoActivity extends Activity {
TextView mDisplay;
AsyncTask<Void, Void, Void> mRegisterTask;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
checkNotNull(SERVER_URL, "SERVER_URL");
checkNotNull(SENDER_ID, "SENDER_ID");
// Make sure the device has the proper dependencies.
GCMRegistrar.checkDevice(this); -
// Make sure the manifest was properly set - comment out this line
// while developing the app, then uncomment it when it's ready.
GCMRegistrar.checkManifest(this); <--------------------------this classs is deprecated
setContentView(R.layout.main);
mDisplay = (TextView) findViewById(R.id.display);
registerReceiver(mHandleMessageReceiver,
new IntentFilter(DISPLAY_MESSAGE_ACTION));
所以我有什么误会吗?任何机构都可以建议我举例 * GoogleCloudMessaging * 类的示例
答案 0 :(得分:2)
呀,你是对的,但也有一个名为gcm client
的目录
如果您去那里浏览,您将获得GoogleCloudMessaging示例:)