blob: 9171e8165418aae2032cbcd38180d21ba657d1e9 (
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
|
package se.leap.bitmaskclient;
import android.content.*;
import se.leap.bitmaskclient.eip.*;
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(Dashboard.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(Constants.ACTION_START_EIP);
dashboard_intent.putExtra(Dashboard.ON_BOOT, true);
dashboard_intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(dashboard_intent);
}
}
}
|