Android 推送通知不适用于版本号为 4.4.2 的 vs450pp

Android Push notification is not working on Model number- vs450pp having version 4.4.2

我在给定型号的 Android phone 上收到推送通知,但是当我点击通知时,它消失了并且没有打开应用程序。如果有人让我摆脱那个问题,我将不胜感激。

尝试以下代码可能适合您。

Intent intent = new Intent(this, MainActivity.class); //define your application activity name which you want to open.
        PendingIntent pIntent = PendingIntent.getActivity(this, 0, intent, 0);


        NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
        Uri soundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);

        NotificationCompat.Builder mBuilder = (NotificationCompat.Builder) new NotificationCompat.Builder(getApplicationContext())
                .setSmallIcon(R.drawable.ic_launcher)
                .setContentTitle("Application Title")
                .setContentText(message)
                .setContentIntent(pIntent)
                .setSound(soundUri); //This sets the sound to play

        notificationManager.notify(0, mBuilder.build());