0

我的C2DMBroadcastReceiver正在工作,但它不是組成的,何時onReceive被解僱?每次應用程序啓動?什麼可能是onreceive不被稱爲的原因?C2DMBroadcastReceiver的onReceive未執行

這是我的清單:

<receiver 
    android:name="my.package.C2DMBroadcastReceiver" 
    android:permission="com.google.android.c2dm.permission.SEND"> 

    <!-- Receive the actual message --> 
    <intent-filter> 
     <action android:name="com.google.android.c2dm.intent.RECEIVE" /> 
     <category android:name="my.package" /> 
    </intent-filter> 
    <!-- Receive the registration id --> 
    <intent-filter> 
     <action android:name="com.google.android.c2dm.intent.REGISTRATION" /> 
     <category android:name="my.package" /> 
    </intent-filter> 
</receiver> 

我這麼想嗎?當然,我有我的寫作my.package.C2DMBroadcastReceiver類正在工作,但我可以理解如何檢查這一點,可能是我需要檢查如果onReceive沒有解僱的問題?

回答

0

由於一個不太明確的原因,接收器類C2DMReceiver必須位於包的根目錄中,該包在清單中聲明爲包名。這是我設法得到這個工作的唯一途徑...所以不是:請follow this ans

And also this ans