1

アプリで通知を表示するためにこれらのコード行を使用しますが、sony デバイス (xperia p、sola、acro s) には通知が表示されません。他のAndroidデバイスでは問題ありません。

Intent notificationIntent = new Intent(context, ActivityShowQuestion.class);
    notificationIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    PendingIntent contentIntent = PendingIntent.getActivity(context,
            Integer.parseInt(id), notificationIntent,
            PendingIntent.FLAG_ONE_SHOT);

    NotificationManager nm = (NotificationManager) context
            .getSystemService(Context.NOTIFICATION_SERVICE);

    Notification.Builder builder = new Notification.Builder(context);

    builder.setContentIntent(contentIntent)
            .setSmallIcon(R.drawable.ic_launcher)
            .setWhen(System.currentTimeMillis())
            .setAutoCancel(true)
            .setContentTitle("title")
            .setContentText("text");
    Notification n = builder.build();

    nm.notify(id, n);

私はそれをグーグルで検索しましたが、答えが見つかりませんでした。

4

1 に答える 1