show activity after notification Android

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:$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() {

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))


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)
    .setContentTitle("Notificación AppMovil")


and i´ve putted my Activity in the Manifest

<activity android:name="es.blabla.appmovil.activity.OpenByNotificationActivity" >

Where is the mistake???

Thanks to everyone!!


Fixed adding android:exported="true" to my activity in the Manifest


Implement this :

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

Notification notification;
PendingIntent contentIntent = PendingIntent.getActivity(context, 0,
new Intent(context, myactivity.class), 0);

 NotificationCompat.Builder builder = new NotificationCompat.Builder(
 notification = builder.setContentIntent(contentIntent)

 notificationManager.notify(0 , notification);


Need Your Help

How efficient is IEnumerable.First and IEnumerable.Last?

.net linq queue ienumerable peek

I want to use a System.Collections.Generic.Queue, but with one difference: I want Queue.Peek to return the last item put in rather than the first. I still want items to enter and exit in the same m...

jquery animate a scroll but not on exact position where the id is since my nav is fixed at the top

jquery html css animation scroll

Basically this is a one page site with fixed header with nav on the top which obviously has height and cover the top portion when scrolled down or clicked the nav. Here is the jquery script I got h...