Вот код:
@Override
public void onReceive(Context context, Intent intent) {
Toast.makeText(context, intent.getAction(), Toast.LENGTH_SHORT).show();
Log.i(TAG, "This is the broadcast receiver");
switch(intent.getAction()) {
case Intent.ACTION_BOOT_COMPLETED: {
mMeetingRoomDeviceSettings = SharedPreferenceManager.getSharedPreferenceValues(context);
// If you need to launch on device restart.
if(mMeetingRoomDeviceSettings.getLaunchOnBootup()) {
Intent configurationIntent = new Intent(context, ConfigureMeetingRoomActivity.class);
configurationIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK
| Intent.FLAG_ACTIVITY_CLEAR_TOP
| Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(configurationIntent);
Log.i(TAG, "Everything went fine.");
}
break;
}
}
}
Не знаю почему, но startActivity () вообще не запускает активность.
Отображаются журналы:
2020-03-06 15:19:06.523 8833-8833/com.eurofins.android.myapplication I/MeetingRoomBroadcast: This is the broadcast receiver
2020-03-06 15:19:06.571 8833-8833/com.eurofins.android.myapplication I/MeetingRoomBroadcast: Everything went fine.