我試圖建立一個應用程序與GCM但每次我得到的phone_registration_error錯誤的時間工作 根據GCM文檔此錯誤意味着:GCM phone_registration_error
Incorrect phone registration with Google.
This phone doesn't currently support GCM.
但我不明白爲什麼我它不支持,我測試了一個真正的Android設備,並與谷歌API的
我的MainActivity一個仿真器上:
@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);
}
和我表現:
手機上運行的Android版本是什麼? – Givi
嘗試在Android版本較高的其他設備上使用應用,而不是所有設備都支持Google Apis。如果你運行一個模擬器,只需創建一個與谷歌API模擬器的Android版本,並在該模擬器上創建谷歌帳戶。在與GCM合作時需要它。 – JunR
在真正的設備上我運行2.3.4和仿真器運行2.2也仿真器有一個谷歌帳戶 –