I′m trying to open an activity after recieiving a PUSH notification.
I recieive the notification, but when i select it nothing happens!
The problem trace is:
W/InputMethodManagerService(771): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@438ae618 attribute=null, token = android.os.BinderProxy@4319aab8
Here is my code
public class GCMIntentService extends IntentService {
private static final int NOTIF_ALERTA_ID = 1;
public GCMIntentService() {
super("GCMIntentService");
}
@Override
protected void onHandleIntent(Intent intent)
{
GoogleCloudMessaging gcm = GoogleCloudMessaging.getInstance(this);
String messageType = gcm.getMessageType(intent);
Bundle extras = intent.getExtras();
if (!extras.isEmpty())
{
if (GoogleCloudMessaging.MESSAGE_TYPE_MESSAGE.equals(messageType))
{
mostrarNotification(extras.getString("message"));
}
}
GCMBroadcastReceiver.completeWakefulIntent(intent);
}
private void mostrarNotification(String msg)
{
NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
Intent notIntent = new Intent(this, OpenByNotificationActivity.class);
PendingIntent contIntent = PendingIntent.getActivity(this, 1, notIntent, 0);
NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this)
.setSmallIcon(android.R.drawable.stat_sys_warning)
.setContentTitle("Notificación AppMovil")
.setContentText(msg)
.setContentIntent(contIntent);
mNotificationManager.notify(NOTIF_ALERTA_ID, mBuilder.build());
}
and i′ve putted my Activity in the Manifest
<activity android:name="es.blabla.appmovil.activity.OpenByNotificationActivity" >
</activity>
Where is the mistake???
Thanks to everyone!!
Edit:
Fixed
adding android:exported="true"
to my activity in the Manifest
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…