我正在尝试设置一个应用程序以使用 gcm 但每次我都收到 phone_registration_error 错误 根据 Gcm 文档,此错误表示:
Incorrect phone registration with Google.
This phone doesn't currently support GCM.
但我不明白为什么我的它不受支持,我在真实的 android 设备和带有 google api 的模拟器上对此进行了测试
我的主要 Activity :
@Override
public void onCreate(Bundle savedInstanceState) {
checkNotNull(SENDER_ID, "SENDER_ID");
GCMRegistrar.checkDevice(this);
GCMRegistrar.checkManifest(this);
final String regId = GCMRegistrar.getRegistrationId(this);
Log.i(TAG, "registration id ===== "+regId);
if(regId.equals("")){
GCMRegistrar.register(this, SENDER_ID);
} else {
Log.v(TAG, "Already Registred");
}
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
还有我的 list :
最佳答案
GCM 仅适用于运行 android 2.2 或更新版本的设备。此外,GCM 仅在为设备安装了谷歌帐户时才有效。这也是谷歌推荐使用 <uses-permission android:name="android.permission.GET_ACCOUNTS" />
的原因在 list 中,以便您确定该设备具有 Google 帐户。
关于android - GCM phone_registration_error,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12772086/