Android Question SDK 34 Manifest and Library

Star-Dust

Expert
Licensed User
Longtime User
Hi,
one of my libraries contains a service. With sdk34 I have to add the permit and the attribute in the manifest. After this change it works correctly
B4X:
AddPermission(android.permission.FOREGROUND_SERVICE_MEDIA_PLAYBACK)
SetServiceAttribute(MyMusicService, android:foregroundServiceType, "mediaPlayback")

When the library is compiled, adding the attribute in the manifest generates an error because it does not find the module because it is contained in the library.

So with the sources of the uncompiled library it works perfectly. Conversely it does not work with the compiled library.

I can't distribute the library source. Is there a way to add permissions and attributes in the manifest without the compiler giving me an error?
 

drgottjr

Expert
Licensed User
Longtime User
how are you declaring your service? fully qualified like this?
B4X:
    <service
      android:name="com.example.library.MyLibraryService"
      android:enabled="true"
      android:exported="false" />
 
Upvote 0

Star-Dust

Expert
Licensed User
Longtime User
do you mean inside my library? I didn't say that.
 
Upvote 0

drgottjr

Expert
Licensed User
Longtime User
i'm asking because i have a library with a nested service (class) in the module. i add it to b4a as a regular library from the ide library tab. i can start the service (and pass a variable which is logged) and stop it from b4a. if your service is nested, it's supposed to be static. presumably, if it's not in an inner class, it wouldn't have to be static. in any case, whether it's static or not, how it's declared in the manifest determines whether it's found or not. that's why i'm asking you how you declare the service. the first problem is finding the service, the second is getting it to start. i have been able to find my service and to start it. my experience may help you.
 
Last edited:
Upvote 0

Star-Dust

Expert
Licensed User
Longtime User
do you mean inside my library? I didn't say that.
It doesn't work with this method. The error is the same can't find the service.

This library is made of B4A. It has a service inside. When I compile an App that calls this library with sdk 34 it generates an error because starting from Android 14 the foreground services must have a defined foreground service type.

When I define it the IDE tells me that it cannot find the service that is internal to the library.
If instead of adding to the library, I add the source of the library, everything works correctly
 
Last edited:
Upvote 0

drgottjr

Expert
Licensed User
Longtime User
your first post says:
"Hi,
one of my libraries contains a service."

and again today you say:
"This bookcase is made of B4A. It has a service inside."
(bookcase would be a translation from italian libreria)

now you say:
"do you mean inside my library? I didn't say that."
yes, you did say that. you have a library with a service. i have a library with a service. mine works; i'm trying to help with yours. i'm sorry.
 
Upvote 0

Star-Dust

Expert
Licensed User
Longtime User
the translation is not always correct
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…