为什么我在不同的设备上有不同的推送通知?

时间:2016-06-20 09:17:14

标签: java android ios push-notification notifications

我需要在推送通知下面实现按钮

我有2个设备Samsung S5Meizu MX5

通知魅族看起来像这样

enter image description here

一切都好吗

但通知三星看起来更糟

enter image description here

这是我的代码

public void With_buttons(View view) {
    Bitmap icon = BitmapFactory.decodeResource(getResources(),
            R.drawable.ic_android_black_24dp);

    Intent resultIntent = new Intent(this, ResultActivity.class);
    TaskStackBuilder stackBuilder = TaskStackBuilder.create(this);
    stackBuilder.addParentStack(ResultActivity.class);
    stackBuilder.addNextIntent(resultIntent);
    PendingIntent resultPendingIntent = stackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT);

    NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);

    Notification notification = new Notification.Builder(this)
            .setVisibility(Notification.VISIBILITY_PUBLIC)
            .setSmallIcon(R.drawable.ic_android_black_24dp)
            .setContentTitle("Wonderful music")
            .setContentText("My Awesome Band")
            .setLargeIcon(icon)
            .addAction(R.drawable.ic_android_black_24dp, "Previous", resultPendingIntent) // #0
            .addAction(R.drawable.ic_android_black_24dp, "Pause", resultPendingIntent)  // #1
            .addAction(R.drawable.ic_android_black_24dp, "Next", resultPendingIntent)     // #2

            .build();

    mNotificationManager.notify((int) System.currentTimeMillis(), notification);
}

这个bug是什么情况?我希望在魅族设备上能看到相同的按钮。

我做错了什么?

0 个答案:

没有答案