show activity after notification Android -
i´m trying open activity after recieiving push notification.
i recieive notification, when select nothing happens!
the problem trace is:
w/inputmethodmanagerservice(771): window focused, ignoring focus gain of: com.android.internal.view.iinputmethodclient$stub$proxy@438ae618 attribute=null, token = android.os.binderproxy@4319aab8
here 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 activity in manifest
<activity android:name="es.blabla.appmovil.activity.openbynotificationactivity" > </activity>
where mistake???
thanks everyone!!
edit:
fixed adding android:exported="true"
activity in manifest
implement :
private void generatenotification(context context, string message) { int icon = r.drawable.ic_launcher; long when = system.currenttimemillis(); string appname = context.getresources().getstring(r.string.app_name); notificationmanager notificationmanager = (notificationmanager) context .getsystemservice(context.notification_service); notification notification; pendingintent contentintent = pendingintent.getactivity(context, 0, new intent(context, myactivity.class), 0); notificationcompat.builder builder = new notificationcompat.builder( context); notification = builder.setcontentintent(contentintent) .setsmallicon(icon).setticker(appname).setwhen(0) .setautocancel(true).setcontenttitle(appname) .setcontenttext(message).build(); notificationmanager.notify(0 , notification); }
Comments
Post a Comment