2013-08-12 32 views
6

Ho lottato con questo errore per molto e ho appena mollato. Ogni volta che provo a inviare un messaggio utilizzando GCM, questo errore appare su LogCat. Cosa non riesco a fare? Ho seguito gli esempi Android per configurare le notifiche GCM. Questo è l'errore LogCatintent annullato. Android GCM

Modifica: il messaggio viene effettivamente visualizzato ma non penso che questo errore sia normale.

08-12 17:13:15.888: W/GTalkService(2237): [DataMsgMgr] broadcast intent callback: result=CANCELLED forIntent { act=com.google.android.c2dm.intent.RECEIVE cat=[com.testing.encuesta] (has extras) } 

AndroidManifest.xml

<permission android:name="com.testing.encuesta.permission.C2D_MESSAGE" 
android:protectionLevel="signature" /> 
<uses-permission android:name="com.testing.encuesta.permission.C2D_MESSAGE" /> 
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" /> 
<uses-permission android:name="android.permission.INTERNET"></uses-permission> 
<uses-permission android:name="android.permission.VIBRATE"></uses-permission> 


<application 
    android:allowBackup="true" 
    android:icon="@drawable/ic_launcher" 
    android:label="@string/app_name" 
    android:theme="@style/AppTheme" > 
    <activity 
     android:name="com.testing.encuesta.MainActivity" 
     android:label="@string/app_name" > 
     <intent-filter> 
      <action android:name="android.intent.action.MAIN" /> 

      <category android:name="android.intent.category.LAUNCHER" /> 
     </intent-filter> 

    </activity> 
    <activity android:name=".Inicio"> 
    </activity> 

     <receiver android:name=".GCMBroadcastReceiver" android:permission="com.google.android.c2dm.permission.SEND" > 
    <intent-filter> 

      <action android:name="com.google.android.c2dm.intent.RECEIVE" /> 
      <category android:name="com.testing.encuesta" /> 
     </intent-filter> 
     <intent-filter> 
      <action android:name="com.google.android.c2dm.intent.REGISTRATION" /> 
      <category android:name="com.testing.encuesta" /> 
     </intent-filter> 

    </receiver> 

La mia classe GCMBroadcastReceiver

public class GCMBroadcastReceiver extends BroadcastReceiver { 

@Override 
public void onReceive(Context context, Intent intent) { 
      try { 
       String action=intent.getAction(); 
       if(action.equals("com.google.android.c2dm.intent.REGISTRATION")) 
       { 
        String registrationID=intent.getStringExtra("registration_id"); 
        Log.d("ID",registrationID); 
        String error=intent.getStringExtra("error"); 
        String unregistered=intent.getStringExtra("unregistered"); 

       } 
       else if(action.equals("com.google.android.c2dm.intent.RECEIVE")) 
       { 
        String data1=intent.getStringExtra("data1"); 
        String data2=intent.getStringExtra("data2"); 
        Toast.makeText(context, data1, Toast.LENGTH_LONG); 

       } 
      } catch (Exception e) { 
       Log.d("Error", "error en C2DM"+e.toString()); 

      } 
} 

risposta

6

fissa, è solo bisogno di aggiungere setResultCode (Activity.RESULT_OK); alla fine di onReceive(); metodo

Problemi correlati