通知関係の機能を一部修正しました。
This commit is contained in:
parent
0a210c5b94
commit
02b4134d41
|
@ -34,8 +34,9 @@ public class MainActivity extends AppCompatActivity {
|
||||||
//通知のやつ↓
|
//通知のやつ↓
|
||||||
int importance = NotificationManager.IMPORTANCE_DEFAULT;
|
int importance = NotificationManager.IMPORTANCE_DEFAULT;
|
||||||
|
|
||||||
NotificationChannel channel = new NotificationChannel("CHANNEL_ID", "サンプルアプリ", importance);
|
NotificationChannel channel = new NotificationChannel("CHANNEL_ID", "通報通知", importance);
|
||||||
channel.setDescription("説明・説明 ここに通知の説明を書くことができる");
|
//説明・説明 ここに通知の説明を書くことができる↓
|
||||||
|
channel.setDescription("第3者からの通報を検知しました");
|
||||||
|
|
||||||
NotificationManager notificationManager = getSystemService(NotificationManager.class);
|
NotificationManager notificationManager = getSystemService(NotificationManager.class);
|
||||||
notificationManager.createNotificationChannel(channel);
|
notificationManager.createNotificationChannel(channel);
|
||||||
|
@ -65,13 +66,13 @@ public class MainActivity extends AppCompatActivity {
|
||||||
}
|
}
|
||||||
|
|
||||||
//↓通知のやつ
|
//↓通知のやつ
|
||||||
public void notifyTest() {
|
public void notifyMain() {
|
||||||
((Vibrator)getSystemService(Context.VIBRATOR_SERVICE)).vibrate(1000);
|
((Vibrator)getSystemService(Context.VIBRATOR_SERVICE)).vibrate(1000);
|
||||||
NotificationCompat.Builder builder = new NotificationCompat
|
NotificationCompat.Builder builder = new NotificationCompat
|
||||||
.Builder(this, "CHANNEL_ID")
|
.Builder(this, "CHANNEL_ID")
|
||||||
.setSmallIcon(android.R.drawable.ic_menu_info_details)
|
.setSmallIcon(android.R.drawable.ic_menu_info_details)
|
||||||
.setContentTitle("タイトル")
|
.setContentTitle("通報検知")
|
||||||
.setContentText("メッセージ・メッセージ")
|
.setContentText("子供の置き去りを検知しました。")
|
||||||
.setPriority(NotificationCompat.PRIORITY_DEFAULT);
|
.setPriority(NotificationCompat.PRIORITY_DEFAULT);
|
||||||
|
|
||||||
NotificationManagerCompat notificationManager = NotificationManagerCompat.from(this);
|
NotificationManagerCompat notificationManager = NotificationManagerCompat.from(this);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user