I have a problem when my GCMIntentService is called, an exception is thrown:
java.lang.ClassCastException: com.test.test.GCMIntentService cannot be cast to android.content.BroadcastReceiver
However my class does extend the GCMBaseIntentService, in fact my construct "ends" well (the super(SENDER_ID); is passed without issues) and the problem comes when exiting the constructor, I suspect when an internal class tries to cast the newly created instance of my extending class.
Code for reference if needed:
--package com.adk.test;import java.io.IOException;import java.util.ArrayList;import java.util.List;import org.apache.http.HttpResponse;import org.apache.http.NameValuePair;import org.apache.http.client.ClientProtocolException;import org.apache.http.client.HttpClient;import org.apache.http.client.entity.UrlEncodedFormEntity;import org.apache.http.client.methods.HttpPost;import org.apache.http.impl.client.DefaultHttpClient;import org.apache.http.message.BasicNameValuePair;import android.app.Notification;import android.os.Bundle;import android.support.v4.app.NotificationCompat;import android.support.v4.app.NotificationCompat.Builder;import android.app.NotificationManager;import android.app.PendingIntent;import android.content.Context;import android.content.Intent;import utilities.Logd;import com.google.android.gcm.GCMBaseIntentService;import com.google.android.gcm.GCMConstants;import com.google.android.gcm.GCMRegistrar;public class GCMIntentService extends GCMBaseIntentService {private final String LOG_TAG = "Test";private final static String senderID = "66610078X85X";public GCMIntentService(){super("66610078X85X");Logd.i(LOG_TAG, "GCM passed");}@Overrideprotected void onError(Context arg0, String errorID) {Logd.e(LOG_TAG, errorID, null);}@Overrideprotected void onMessage(Context arg0, Intent intent) {enviarNotificacion(arg0, intent);}@Overrideprotected void onRegistered(Context arg0, String deviceID) {Registrar(arg0, deviceID);
Logd.i(LOG_TAG, "Registered");}@Overrideprotected void onUnregistered(Context arg0, String arg1) {Logd.i(LOG_TAG, "Unregistered");}}
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
No comments:
Post a Comment