Advertisement
Guest User

Untitled

a guest
Aug 19th, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. PackageManager p = getPackageManager();
  2. ComponentName componentName = new ComponentName(this, MainActivity.class);
  3. p.setComponentEnabledSetting(componentName, PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP);
  4.  
  5. <receiver android:name="simpress.mobileinfo.MainActivity$MyBroadCastReceiver">
  6. <intent-filter>
  7. <action android:name="android.intent.action.BOOT_COMPLETED" />
  8. </intent-filter>
  9. </receiver>
  10.  
  11. @Override
  12. public void onReceive(Context context, Intent intent) {
  13.  
  14. if (intent.getAction().equals(Intent.ACTION_BOOT_COMPLETED)) {
  15. Intent i = new Intent(context, MainActivity.class);
  16. i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
  17. context.startActivity(i);
  18. }
  19. }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement