0

我正在使用Titanium Appcelerator以在Android上實現C2DM。在他們的論壇和Stackoverflow上看到很多答案後,我發現a guide讓我編譯並將模塊(titanium-c2dm from GitHub)合併到我的程序中。我能夠編譯和正確鏈接一切,但在試圖按照示例代碼C2DM和鈦Appcelerator集成

c2dm.registerC2dm(senderId, { 
    success:function(e) 
    { 
     //stuff here 
    }, 
    error:function(e) 
    { 
     //stuff here 
    }, 
    callback:function(e) // called when a push notification is received 
    { 
     //stuff here 
    } 
}); 

我得到我的設備上出現以下錯誤登記(來自亞行logcat):

I/TiAPI (2731): Registering... 
D/C2dmModule(2731): (KrollRuntimeThread) [196,687] registerC2dm called 
D/C2dmModule(2731): (KrollRuntimeThread) [1,688] get registrationId property 
MORE STUFF HAPPENS HERE 
W/ActivityManager( 127): Unable to start service Intent 
          {act=com.google.android.c2dm.intent.REGISTRATION 
          cat=[com.vivas.c2dmtest] cmp=com.vivas.c2dmtest/com.findlaw.c2dm.C2DMReceiver (has extras) }: not found 

有誰有任何想法如何將其納入我的項目? 任何幫助,將不勝感激

+0

你能分享你如何得到它編譯?當我嘗試用螞蟻構建時,它會給我一個構建錯誤,它顯然找不到gpref? – 2012-07-06 18:56:39

回答

2

這個工作對我來說:

在tiapp.xml和timodule.xml變化

<service android:name=".C2DMReceiver"/> 

<service android:name="com.findlaw.c2dm.C2DMReceiver"/> 
+0

感謝您的迴應,這似乎已經做到了。我收到了有效註冊ID的成功註冊! – avivas 2012-04-20 13:50:52