The essence of the problem: if there is a PIN-code on the device screen, an Android screen pattern, or something like that, then clicking on Push simply calls the MainActivity application. If there is no key, it opens the desired Activity .
My GCMListener code :
@Override public void onMessageReceived(String from, Bundle data) { String id = data.getString("news_id"); String message = data.getString("message"); Random random = new Random(); Intent intent = new Intent(this, SpecificNewsActivity.class); intent.putExtra("newsId", id); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); PendingIntent pendingIntent = PendingIntent.getActivity(this, random.nextInt(), intent, PendingIntent.FLAG_ONE_SHOT); Uri defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION); NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this) .setSmallIcon(R.mipmap.ic_launcher) .setContentTitle(getString(R.string.app_name)) .setContentText(message) .setAutoCancel(true) .setSound(defaultSoundUri) .setContentIntent(pendingIntent); NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); notificationManager.notify(random.nextInt(), notificationBuilder.build()); } What could be a mistake?
Extras: It turned out that such a problem is only on Chinese phones (Meizu, Xiaomi for example).