So basically I can do this:
- Copy my current manifest to an external file (backup)
- Empty the manifest, save and reopen it to get a fresh manifest template
- Add back everything from the backup that wasn't related to permissions
- Add permissions required by JavaObjects in my code
- Add permissions required by any extra libraries I've installed
- Change DirRootExternal/DirDefaultExternal to DirInternal/GetSafeDirDefaultExternal to avoid some permissions
And then I'm done and have a perfect, slim manifest. Correct?
Follow-up questions:
How to determine if JavaObjects require permissions
In my code I have these two JavaObjects:
Dim channel As JavaObject
channel.InitializeNewInstance("android.app.NotificationChannel", Array(channelId, Application.LabelName, ImportanceLevel))
and
Dim ctxt As JavaObject
ctxt.InitializeContext
Dim manager As JavaObject = ctxt.RunMethod("getSystemService", Array("notification"))
manager.RunMethod("createNotificationChannel", Array(channel))
I'm generally clueless when it comes to JavaObject so I don't really know what to look for. I tried googling for permission and the different names in the code, so "permission android.app.NotificationChannel", "permission getSystemService" and "permission createNotificationChannel". These search terms led me to pages like these:
-
https://developer.android.com/reference/android/app/NotificationChannel
-
https://developer.android.com/reference/android/content/Context
-
https://developer.android.com/training/notify-user/channels
None of these pages seemed to indicate anything regarding permissions.
Please note that I'm not looking for info on this exact JavaObject code. I'm really, really trying to understand the thinking I need to solve this myself and not having to ask on the forum each time.
@Erel , how do you know whether some JavaObject requires a permission? Can you look it up somewhere in some reference doc, or is it just something that you have learned over the years through trial and error..?
How to determine if a Library require permissions
In my case I use
the very nice lib QRCodeReaderView by
@Johan Schoeman. Looking at the lib in
the very nice B4x Object Browser by
@Vader, which lists permissions, I can see none listed. Yet, looking at the forum page for the lib, Johan has specified three required permissions.
Does this mean that these are the steps to determining what permissions a lib needs?
- Check the documentation on the forum for the lib
- Ask the author
- Test the lib as much as possible in the app and see if it crashes
Did I miss something? The lib doesn't really specify those things itself?