以下是如何從谷歌註冊GCM。在第二行代碼中,我把我的appid放在哪裏?敬請思考它是我的項目在Google App Engine上的名稱嗎?我在哪裏放置GCM的應用程序ID?
發件人是授權發送消息給應用程序的帳戶的標識,通常是由應用程序開發人員設置的帳戶的電子郵件地址。 app是應用程序的ID,使用PendingIntent設置以允許註冊服務提取應用程序信息。 例如:
Intent registrationIntent = new Intent("com.google.android.c2dm.intent.REGISTER");
registrationIntent.putExtra("app", PendingIntent.getBroadcast(this, 0, new Intent(), 0)); // boilerplate
registrationIntent.putExtra("sender", "[email protected]");
startService(registrationIntent);