0
我在Android應用程序中遇到了一個奇怪的問題。 我使用jQuery Mobile和科爾多瓦2.4與GCM插件在這裏找到:https://github.com/marknutter/GCM-CordovaAndroid GCM服務適用於一款平板電腦,但不適用於其他
奇怪的是,這個代碼工作完全在我的Nexus 7上運行4.2.2但另一方面,儘管更糟糕,隱形三重奏Pro平板電腦運行4.0.4,代碼根本不起作用。我提出請求時,我沒有收到GCM服務器返回的註冊ID。
下面是javascript代碼使電話:
//cordova's deviceready callback
function onDeviceReady() {
document.addEventListener("backbutton", onBackKeyDown, false);
//setup for GCM Messaging
userContext.deviceReady = true;
window.plugins.GCM.register(MY_PROJECT_NUMBER, "GCM_Event", GCM_Success, GCM_Fail);
}
//called from specified attribute in login.html <body onload="onLoad()">
function onLoad() {
document.addEventListener("deviceready", onDeviceReady, false);
document.addEventListener("pause", function() {
unregisterGCM();
},
false);
}
我收到了一些錯誤,我的應用程序啓動後,但我做的註冊電話,但他們似乎完全無關。
"call to OpenGL ES API with no current context (logged once per thread)"
爲什麼兩個平板電腦之間會有這種完全不同的行爲?
哇。對我而言,這是很大的疏忽。我只是假定它會支持Google Play商店,但沒有進行檢查。 – 2013-05-02 14:57:29
@AaronSpringer:缺乏官方Play Store支持在低端設備中流行。這沒什麼不妥 - 但是,Kindle Fire沒有Play商店支持,因此不支持GCM。但是,某些服務(如GCM)僅適用於支持Play商店的設備。基本上,此頁面上列出的任何內容都將具有此限制:http://developer.android.com/google/index.html – CommonsWare 2013-05-02 15:00:36