The application uses the service start function after a reboot (it can be turned off / on). Code :
Receiver: In the onReceive method:
App.getAppContext().startService( new Intent(App.getAppContext(), MyService.class)); When you press the control, turn off / on the receiver:
ComponentName receiver = new ComponentName(ctx, Receiver.class); PackageManager packageManager = ctx.getPackageManager(); int state = enabled ? PackageManager.COMPONENT_ENABLED_STATE_ENABLED : PackageManager.COMPONENT_ENABLED_STATE_DISABLED; packageManager.setComponentEnabledSetting(receiver, state, PackageManager.DONT_KILL_APP); In the manifest
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/> <action android:name="android.intent.action.BOOT_COMPLETED"/> <action android:name="android.intent.action.QUICKBOOT_POWERON"/> The difficulty is that when you reboot a device with Android 4.2.2, my application is displayed in the list of executables, although the service should not start (the position of the control in preferences -disabled). On other devices on which I tested the application, everything worked out correctly. When the control is in the on state, the service starts upon reboot, if off it is not. What could be the reason for this behavior?