2013-03-20 74 views
0

以下是如何從谷歌註冊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); 

回答

1

您報價中的代碼部分錯誤。 sender的值曾經是電子郵件地址(在現在已棄用的C2DM中),但在GCMsender應包含Google API項目ID。

發件人是授權發送消息到Android應用程序的帳戶的項目號。

app是Android應用程序的ID,使用PendingIntent設置以允許註冊服務提取Android應用程序信息。

相關問題