blob: a72a8809daa200402fe331317deea60b19a2ca7f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
package se.leap.bitmaskclient;
import android.content.*;
import se.leap.bitmaskclient.eip.EIPConstants;
public class OnBootReceiver extends BroadcastReceiver {
SharedPreferences preferences;
// Debug: am broadcast -a android.intent.action.BOOT_COMPLETED
@Override
public void onReceive(Context context, Intent intent) {
preferences = context.getSharedPreferences(Constants.SHARED_PREFERENCES, Context.MODE_PRIVATE);
boolean provider_configured = !preferences.getString(Provider.KEY, "").isEmpty();
boolean start_on_boot = preferences.getBoolean(Dashboard.START_ON_BOOT, false);
if (provider_configured && start_on_boot) {
Intent dashboard_intent = new Intent(context, Dashboard.class);
dashboard_intent.setAction(EIPConstants.ACTION_START_EIP);
dashboard_intent.putExtra(Dashboard.ON_BOOT, true);
dashboard_intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(dashboard_intent);
}
}
}
|