Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 package eu.intermodalics.tango_ros_streamer.android;
00018
00019 import android.content.BroadcastReceiver;
00020 import android.content.Context;
00021 import android.content.Intent;
00022 import android.content.SharedPreferences;
00023 import android.preference.PreferenceManager;
00024
00025 import eu.intermodalics.tango_ros_streamer.R;
00026 import eu.intermodalics.tango_ros_streamer.activities.RunningActivity;
00027
00028 public class RunAppOnStartupBroadcastReceiver extends BroadcastReceiver {
00029 @Override
00030 public void onReceive(Context context, Intent intent) {
00031 SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context);
00032 boolean runAtBoot = sharedPreferences.getBoolean(context.getString(R.string.pref_run_at_device_boot_key), false);
00033 if (runAtBoot && intent.getAction().equals(Intent.ACTION_BOOT_COMPLETED)) {
00034 Intent startRunningActivityIntent = new Intent(context, RunningActivity.class);
00035 startRunningActivityIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
00036 context.startActivity(startRunningActivityIntent);
00037 }
00038 }
00039 }