开发者

Question about Save to SD card

I have a few apps that are getting larger as I improve functionality. I have had a few request to enable the ability to save the apps to the SD card.

I want to keep my apps available to early versions of Android. Can someone te开发者_StackOverflow社区ll me what code I need to add that allows save to SD without increasing my min SDK?

Thanks


You need to target at least API version 8 (Froyo) using android:targetSdkVersion in the uses-sdk section of your manifest. Then you should also define android:installLocation in the manifest to either "preferExternal" or "auto" to enable install to SD. For backwards compatibility you can set android:minSdkVersion to allow your app to be installed on earlier versions of Android.


Use android:targetSdkVersion to indicate which API level you're targeting. Then you need to use android:minSdkVersion to declare the minimum API level, where the phones at this level will ignore higher unknown attributes in the manifest file and then you're free to use which feature you want (e.g. SD card feature). What's important is that your code must target the android:minSdkVersion in order to get your application running on these devices.

See this for more information, especially the Backward Compatibility section.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜