GCM 推送通知在 GCM 诊断中得到确认,但 return 推送时未注册

GCM Push Notifications being Acknowledged in GCM Diagnostics but return NotRegistered upon Push

我有一个可以接收推送通知的 Android 应用程序。它适用于我的模拟器以及我个人的 Nexus 5 phone。客户不再收到推送通知。当我推送到他们刚刚在 5 分钟内注册的注册令牌时,服务器响应:

{"multicast_id":6888881773609253298,"success":0,"failure":1,"canonical_ids":0,"results":[{"error":"NotRegistered"}]}

在 Play 开发者控制台的 GCM 诊断面板中,它指出推送通知已确认。

怎么可能?

AndroidManifest.xml

<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>

<permission
    android:name="com.my.app.permission.C2D_MESSAGE"
    android:protectionLevel="signature"/>
<uses-permission android:name="com.my.app.permission.C2D_MESSAGE"/>

<!-- Services -->

<service
    android:name=".pushNotifications.InstanceIdListenerService"
    android:exported="false">
    <intent-filter>
        <action android:name="com.google.android.gms.iid.InstanceID"/>
    </intent-filter>
</service>

<service
    android:name=".pushNotifications.MyAppGcmListenerService"
    android:exported="false">
    <intent-filter>
        <action android:name="com.google.android.c2dm.intent.RECEIVE"/>
    </intent-filter>
</service>

<!-- End Services -->

<receiver
    android:name="com.google.android.gms.gcm.GcmReceiver"
    android:exported="true"
    android:permission="com.google.android.c2dm.permission.SEND">
    <intent-filter>
        <action android:name="com.google.android.c2dm.intent.RECEIVE"/>

        <category android:name="com.my.app"/>
    </intent-filter>
</receiver>

如何检索令牌:

try
{
    String token = InstanceID.getInstance(_context)
                             .getToken(_context.getString(R.string.push_notification_sender_id),
                                       GoogleCloudMessaging.INSTANCE_ID_SCOPE);

    _preferencesService.setPushNotificationToken(token);

    listener.complete();
}
catch (IOException e)
{
    listener.error(e);
    Log.e(_context.getPackageName(), e.getMessage());
}

这个错误不是由 GCM 引起的。客户的 API 没有正确处理令牌。