Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android - How to start an application on the /sdcard after boot

Is there a way how to start and android application after a boot automatically if it is on the /sdcard?

Ok, probably by BroadcastReceiver. But which action is the right one?

ACTION_BOOT_COMPLETED - does not work if it is on the /sdcard (documented)
ACTION_MEDIA_MOUNTED - does not work if it is on the /sdcard (which is undocumented)
ACTION_EXTERNAL_APPLICATIONS_AVAILABLE - does not work, I do not know why
ACTION_USER_PRESENT - does not work if the BroadcastReceiver is registered in AndroidManifest (which is undocumented, but documentation bug has been reported)

Thanks
Jan

like image 327
Jan Nemec Avatar asked Apr 21 '11 09:04

Jan Nemec


People also ask

Can you boot Android from SD card?

Boot Android from the microSD card Power off the device. Insert the microSD card into the microSD card holder (bottom side of the board). Change the boot mode configuration to boot from the microSD card.

How do I install an SD card on my Android phone?

Insert the SD card into the device. To launch the process, set the device into Recovery Mode (steps to put into recovery mode depends on the device, check the manual). Use navigation buttons to select install from SD card. Use navigation buttons to select the zip file to launch the process.


2 Answers

try using <receiver android:name=".BootCompleteReceiver" > <intent-filter> <action android:name="android.intent.action.BOOT_COMPLETED" /> <action android:name="android.intent.action.QUICKBOOT_POWERON" /> </intent-filter> </receiver>

and this <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />

perhaps QUICKBOOT_POWERON help u

like image 80
Amir K. Zarini Avatar answered Sep 20 '22 20:09

Amir K. Zarini


Please mention it in manifest file.

</uses-permission>    
<receiver android:name=".BootReceiver"
    android:enabled="true"
    android:exported="true"
    android:label="BootReceiver">
    <intent-filter>
        <action android:name="android.intent.action.BOOT_COMPLETED"></action>
    </intent-filter>
</receiver>

provide permission "android.permission.RECEIVE_BOOT_COMPLETED" as child of menifest.

and one more thing your app must not be installed in sdcard.

like image 32
Rahul Chaudhary Avatar answered Sep 18 '22 20:09

Rahul Chaudhary