I wrote a program that worked perfectly until the market required me to add 'minSdkVersion'. Since I was using 2.3.3 capabilities I set it at 10,but then my program stopped being able to access files from the disk (all file access is false though it works without 'minSdkVersion'). Changing it to require API 1 fixed the functionality but now inadequate OS versions can download it. Should the 'minSdkVersion' be able to change actual functionality? Any ideas what could cause this?
You should set minSdkVersion to the lowest adequate OS version for your app. Don't forget to also set targetSdkVersion to the highest level for which your app has been tested.
I'm going to assume when you say "access files" you mean on the SD card.
In this case, you need to add 2 new permissions:
<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission
android:name="android.permission.READ_EXTERNAL_STORAGE"/>
These permissions weren't added until API level 4, so anything below that gets them for free.
Related
I know we should add "ACCESS_FINE_LOCATION" and "ACCESS_COARSE_LOCATION" permissions and for Android 10 and higher we should add "ACCESS_BACKGROUND_LOCATION".
But if my app is going to be published for all versions starting from android 7 to the latest android 12, how would my AndroidManifest file look like? should I add all the 3 above permissions together?
Adding (even unneccessary) permissions will not lead to crashes or bugs (at least as far as I know), so you can and should add those 3 permissions together, if you want to support that wide range of android versions
I have a Cleaner app in java that has features like - System cleaner, Whatsapp manager, and Basic file Explorer to list & delete files i.e. downloads, images, videos, documents and audio.
Now it has to comply with Google's scoped storage enforcement or it will be removed from the store.
My question here is:
How to I make sure I am using correct permissions to comply with this policy? While making sure the older versions of Android would
still work as normally (or scoped storage api works with them too?).
What I have already done:
<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
android:maxSdkVersion="28" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_INTERNAL_STORAGE" />
I have updated the permissions as shown above^ and set target sdk to 30, as well as removed requestLegacyExternalStorage flag from
manifest file.
Notice that WRITE_EXTERNAL_STORAGE is using max sdk = 28 tag, do I need to do this with other two (READ&WRITE) permissions also? (official doc only showed example of write-external-storage permission)
I'm still asking for these permissions in java code - do I need to wrap that code using if (Build.VERSION.SDK_INT < 30) to make sure
it's only asked in lower android versions or using the above tag in
manifest already takes care of that for me?
I have already implemented the requestDeletePermission() dialog for deleting files in Android 11 - it works! But for listing files in Basic explorer I'm
still using the old code that worked in old Android versions - do I
need to update that too? (Although it's still working with above 3 permissions)
Please help me I really have to finish it before the end of this month or my app will get removed. The whole point is to avoid violating the new policy in Android 11. I'm willing to give higher bounty to elaborative answers.
Thank you.
Im using WebRTC with cordova and I made the huge mistake of upgrading the version of android in the play store from 22 to 23. (apparently no way to revert this situation)
Now I must ask for the permissions at runtime. Everything is ok for now, but for WebRTC communication my app needs this particular permission "MODIFY_AUDIO_SETTINGS". For camera, microphone and location permissions I use cordova-diagnostic-plugin using those methods : requestCameraAuthorization, requestMicrophoneAuthorization and requestLocationAuthorization.
I tried requestRuntimePermission method with this as argument cordova.plugins.diagnostic.permission.MODIFY_AUDIO_SETTINGS but its not working since cordova.plugins.diagnostic.permission doesnt contain 'MODIFY_AUDIO_SETTINGS' permission. Here is the list of available permissions :
Im pretty much sur that the problem is the lack of 'MODIFY_AUDIO_SETTINGS' permission, since I had the same problem with android 22 (no audio) because I was not including it in the config. see this old SO post of mine
Thanks.
MODIFY_AUDIO_SETTINGS is not a "dangerous" permission that can be requested at run-time on Android: see here the full list of "dangerous" permissions which need to be requested at run-time.
So in my app i would like to add an option to selectively add a permission (say, direct dial) when the user is on Android M but, at the same time, i would like to have that permission NOT showing as required in API 22 or lower simply because its not essential so i prefer not asking for it during install (so de facto making that feature available on M only).
So, i understand the new model of M is that it will allow optional permissions when user is on M and it will make those permissions mandatory when on lower APIs. So is there any known way to just remove those permissions on API lower than 23? Without having separate flavours / APK?
Maybe merging a manifest with just those lines when API is > 22 ? Or there is a cleaner solution?
This is possible. When reading the documentation there is a special flag to indicate for M only.
Use
<uses-permission-sdk23>
to apply permission for Marshmallow devices only.
This is my problem:
I have an application that requires a certain persmission (Write-SMS) that will of course only function on phones. Now, the app requires that permission for a feature that will be disabled on tablet versions but it won't let users install the app on tablets.
I guess my question is this:
Can I easily create a second manifest for the tablet version, that will be roughly the same as the phone version but without the persmission?
If I'm doing so, is there a way to check what manifest version is being used? I might want to add features to the tablet version that are tablet exclusive and vice versa.
All of course preferibly in one apk, that gets exported and signed once. Thanks for your help in advance!
Simple add:
<uses-feature android:name="android.hardware.telephony" android:required="false" />
To your manifest. The SMS permission automatically asks for a Telephony feature. Adding this tells android that even though you ask for this feature, you don't need it.
Be sure to add an if-else check to see if you can sens SMS from the device before doing so.
I think you must check it in the actual method itself, because permissions can be optional or compulsory, but that's it, not distinguishable for different devices..