【问题标题】:Android Java Notification To AlarmAndroid Java 通知警报
【发布时间】:2015-09-12 19:44:26
【问题描述】:

如何重建通知以获得“通知警报” 我尝试了 varois 的东西,但没有任何效果,我真的很沮丧,所以我终于在这里问了。

主要活动:

public void sendNotificationIfTimeEnd01() {
    Context context = getApplicationContext();
    Intent intent01 = new Intent(context, MainActivity.class);
    PendingIntent pendingIntent01 = PendingIntent.getActivity(this, 1, intent01, 0);
    NotificationCompat.Builder builder01 = new NotificationCompat.Builder(this)
            .setSmallIcon(R.drawable.ic_stat_notification)
            .setContentIntent(pendingIntent01)
            .setAutoCancel(true)
            .setLargeIcon(BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher))
            .setContentTitle(gamesJuliToStringArray[1])
            .setContentText("Spiel ist bereit")
            .setSubText("click");
    NotificationManager notificationManager = (NotificationManager) getSystemService(
            NOTIFICATION_SERVICE);
    notificationManager.notify(NOTIFICATION_ID_01, builder01.build());
    try {
        Uri notification = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
        Ringtone r = RingtoneManager.getRingtone(getApplicationContext(), notification);
        r.play();
    } catch (Exception e) {
        e.printStackTrace();
    }
}

我的片段中的条件:

    if (!notification062 && !buttonColor02.equals("red02")) {
        activity.sendNotificationIfTimeEnd01();
    }

如果条件发生,我会再次收到通知,但仅限于我的应用程序内部。 需要帮助将其重建为警报通知

【问题讨论】:

    标签: java android notifications fragment alarm


    【解决方案1】:

    Here 您可以看到一个示例,该示例使用 AlarmManager 来安排稍后的通知,给定特定的延迟。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多