通知IDを修正

This commit is contained in:
ろむねこ 2024-07-11 16:53:22 +09:00
parent dbbe4b2f1e
commit b6c1bbd213
No known key found for this signature in database
GPG Key ID: FA1F39A1BA37D168

View File

@ -36,8 +36,9 @@ public class TestService extends Service {
private final String title; private final String title;
private final String description; private final String description;
private final String channelId; private final String channelId;
private final int notificationId;
public NotificationContent(String title, String description, String channelId) { public NotificationContent(String title, String description, String channelId, int notificationId) {
this.title = title; this.title = title;
this.description = description; this.description = description;
this.channelId = channelId; this.channelId = channelId;
@ -54,6 +55,10 @@ public class TestService extends Service {
public String getChannelId() { public String getChannelId() {
return channelId; return channelId;
} }
public int getNotificationId() {
return notificationId;
}
} }
public static final String TAG = "InspirationQuote"; public static final String TAG = "InspirationQuote";
@ -65,9 +70,9 @@ public class TestService extends Service {
// DEBUG // DEBUG
private static final int NOTIFICATION_DELAY = 5 * 1000; // 15 seconds private static final int NOTIFICATION_DELAY = 5 * 1000; // 15 seconds
private static final NotificationContent REPORTED_NOTIFICATION = private static final NotificationContent REPORTED_NOTIFICATION =
new NotificationContent("子供の置き去りをしていませんか?", "第三者からの通報が行われました。", REPORTED_CHANNEL_ID); new NotificationContent("子供の置き去りをしていませんか?", "第三者からの通報が行われました。", REPORTED_CHANNEL_ID, 1);
private static final NotificationContent BLUETOOTH_NOTIFICATION = private static final NotificationContent BLUETOOTH_NOTIFICATION =
new NotificationContent("子供の置き去りをしていませんか?", "Bluetoothと車の切断から5分が経過しました", BT_ALERT_CHANNEL_ID); new NotificationContent("子供の置き去りをしていませんか?", "Bluetoothと車の切断から5分が経過しました", BT_ALERT_CHANNEL_ID, 2);
private String userId = null; private String userId = null;
@ -280,7 +285,7 @@ public class TestService extends Service {
NotificationManager notificationManager = context.getSystemService(NotificationManager.class); NotificationManager notificationManager = context.getSystemService(NotificationManager.class);
notificationManager.notify(R.string.app_name, builder.build());//通知の表示 notificationManager.notify(content.getNotificationId(), builder.build());
} }
private final BroadcastReceiver receiver = new BroadcastReceiver() { private final BroadcastReceiver receiver = new BroadcastReceiver() {