Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

android start service on boot

<!-- Allows application to receive actions related to rebooting -->
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />

<!-- Inside your <application> -->
<receiver
	android:name="com.example.MyBroadcastReceiver"
	android:exported="true"
	android:enabled="true"
    android:installLocation="internalOnly">
	<intent-filter>
		<!-- Handles cold reboot (power off/on) -->
		<action android:name="android.intent.action.BOOT_COMPLETED" />
		<!-- Handles quick restart -->
		<action android:name="android.intent.action.QUICKBOOT_POWERON" />
	</intent-filter>
</receiver>
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #android #start #service #boot
ADD COMMENT
Topic
Name
2+8 =