Wish Ability to specify app manifest entries in b4xlib

Sandman

Expert
Licensed User
Longtime User
This must have been mentioned before, but I was unable to find a thread about it so here we are.

In our b4xlibs we can have a manifest file where we specify dependencies to other libraries. This is awesome.

However, it does not describe the whole situation when we discuss dependencies. For B4A, there's also the application manifest file (and for B4i there's the PlistExtras). As far as I can tell, there is currently no way to include that in the b4xlib, which creates the need for instructions like these:

While I have much love for b4xlibs, I think there's room for improvement in this regard.

So my wish is that it would be possible to include some more info in the b4xlib. I think the b4xlibs should contain everything required within them. As it is now, that is true to 95%. This wish is about going to 100%.

Imagine if the FileProvider b4xlib had this included in itself, and that the IDE, when compiling, simply added it to the application manifest. There would be no need for any more instructions than "Enable FileProvider".
android_app_manifest_addition.txt:
AddManifestText(<uses-permission
   android:name="android.permission.WRITE_EXTERNAL_STORAGE"
   android:maxSdkVersion="18" />
)

AddApplicationText(
  <provider
  android:name="android.support.v4.content.FileProvider"
  android:authorities="$PACKAGE$.provider"
  android:exported="false"
  android:grantUriPermissions="true">
  <meta-data
  android:name="android.support.FILE_PROVIDER_PATHS"
  android:resource="@xml/provider_paths"/>
  </provider>
)

CreateResource(xml, provider_paths,
   <files-path name="name" path="shared" />
)
(The same logic could be applied to the B4i PlistExtras.)

This wish might not make much sense to people not using a lot of b4xlibs, but once you start using more, and all of a sudden need to keep track of what library was the cause for part of the manifest, things tend to get complicated. I am obviously aware that it's possible to use comments in the manifest file, but there's still a lot of manual work for something that seems to be able to automate away.
 

Theera

Well-Known Member
Licensed User
Longtime User
My openion,Is there strategy the non-expert can select in combobox then automatical of addition lines which we can set name in our understanded language ? (alike What you see ,what you get)
 

Theera

Well-Known Member
Licensed User
Longtime User
Last edited:

Sandman

Expert
Licensed User
Longtime User
It doesn't seem to relate to my wish. Perhaps you should post your own wish, with clear examples.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
B4X:
CreateResourceFromFile(Macro, FirebaseAnalytics.GooglePlayBase)
CreateResourceFromFile(Macro, FirebaseAnalytics.Firebase)
CreateResourceFromFile(Macro, FirebaseAnalytics.FirebaseAnalytics)
CreateResourceFromFile(Macro, FirebaseNotifications.FirebaseNotifications)

1. This is the suggested solution. The macros come from files that are part of the libraries.
2. The problem with automatically adding snippets is that there are cases where you need to customize the snippet. This includes the FileProvider snippet. Once the snippets are added magically it becomes more difficult to remove them when needed.
 

Sandman

Expert
Licensed User
Longtime User
1. This is the suggested solution. The macros come from files that are part of the libraries.
I don't consider it perfect, but at least there is clarity on what library is referenced. If we could do this with b4xlibs I would consider it good enough. But this isn't possible with b4xlibs, right?


2. The problem with automatically adding snippets is that there are cases where you need to customize the snippet.
Yes, I agree that is a complication. But on the other hand there are many libs that would need no customization. It would still be possible to not include the manifest thing in the lib and ask the dev to add it manually, if that suits the lib better.
 
Top