[解決了,但我仍然希望爲最後一個問題提供答案,問題是我使用的是大寫字母而不是較低的代碼讓其他人可以更正錯誤]我無法在一個應用程序中獲取Android中的GCM ID
我已經嘗試了一些論壇頁面,並通過相同的東西stackoverflow搜索,但我沒有找到解決方案。
我有2個應用程序使用推送消息,一個應用程序效果很好,但另一個沒有,我在Google註冊2次,所以我得到2個不同的Api密鑰和2個不同的發件人ID,如果我切換髮件人ID我仍然沒有得到應用的ID不工作(但對偉大工程應用工作),它永遠不會觸發onRegistered功能
我的清單
<permission android:name=""com.sexolia.sexyAsiaticas.permission.C2D_MESSAGE" android:protectionLevel="normal" />
<uses-permission android:name="com.sexolia.sexyAsiaticas.permission.C2D_MESSAGE" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />
我的接收機
<receiver android:name="com.google.android.gcm.GCMBroadcastReceiver"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="com.sexolia.sexyasiaticas" />
</intent-filter>
</receiver>
我的服務
<service android:name=".GCMIntentService" />
我的寄存器功能
public void registrarGcm(Context ctx)
{
String regId = GCMRegistrar.getRegistrationId(ctx);
if (regId.equals(""))
{
GCMRegistrar.register(ctx, "795463622136"); //Sender ID
}
}
構造
public GCMIntentService() {
super("795463622136");
}
而且,我會想知道,我怎麼能確定哪些應用程序發送推送消息(是的API密鑰,發件人ID或什麼?)?當1個用戶在Google上註冊時,它對於不同的應用程序有不同的GCM ID?