2024-01-18 19:28:17 +00:00
|
|
|
package com.example.childguard;
|
|
|
|
|
|
|
|
import android.content.BroadcastReceiver;
|
|
|
|
import android.content.Context;
|
|
|
|
import android.content.Intent;
|
|
|
|
|
2024-01-18 19:42:53 +00:00
|
|
|
public class NotificationReceiver extends BroadcastReceiver {//通知をタップしたときにアプリを起動する処理
|
2024-02-01 06:30:39 +00:00
|
|
|
|
2024-01-18 19:28:17 +00:00
|
|
|
@Override
|
|
|
|
public void onReceive(Context context, Intent intent) {
|
2024-01-18 19:42:53 +00:00
|
|
|
if (intent.getAction() != null && intent.getAction().equals("OPEN_ACTIVITY")) {// 通知がタップされたときの処理
|
2024-01-18 19:28:17 +00:00
|
|
|
Intent openIntent = new Intent(context, MainActivity.class); // MainActivityを起動
|
|
|
|
openIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
|
|
|
context.startActivity(openIntent);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|