Sandeep Kumar P K
Sandeep Kumar P K

Reputation: 7482

Android launcher app- Can't read file on boot up

In my launcher app I couldn't read file when it runs on boot up it says
java.io.FileNotFoundException: /mnt/sdcard/folder/languagelist.xml (Permission denied)

It works fine if we run it when android default launcher already launched.
I have given permissions for reading from sd card and I used following code in manifest for converting my activity as launcher.

<category android:name="android.intent.category.HOME"/>
<category android:name="android.intent.category.DEFAULT" />

How can I solve this issue?

Upvotes: 0

Views: 345

Answers (3)

Utkan Ozyurek
Utkan Ozyurek

Reputation: 638

You can use Thread.sleep( some_Time); on your boot receiver.

Upvotes: 0

Dharmendra
Dharmendra

Reputation: 34026

Probably you are getting this error because device has not sd-card.Emulator has lots of issues

Solution

  • Delete the old AVD and create new AVD.
  • Run your application on the new AVD.

Upvotes: 0

Kuffs
Kuffs

Reputation: 35651

On some devices the SD card is not always available right away after boot (the reason why many widgets will not work if they are installed on SD card).

Maybe your device is one of these in which case you could repeat your attempt every few seconds after boot until the SD card is available and the read succeeds.

Upvotes: 1

Related Questions