Java Question Including Services in b4a library

DonManfred

Expert
Licensed User
Longtime User
Am i able to just include services (2rd-party service which extends android.app.servide)
I just need to include two of them and be able to start them.

I already included the service-modules into a library and used the ,anifestentries as shown in the example-app

B4X:
public class MyService extends Service {
B4X:
public class BluetoothLeService extends Service {

Both i just need to start from within my library or directly from b4a. But how do i start them?

The Services are included in the manifest like this
B4X:
AddManifestText(
    <service
        android:name="com.example.uhfreader816ubt.BluetoothLeService"
        android:enabled="true" >
    </service>
    <service
        android:name="com.example.uhfreader816ubt.MyService"
        android:enabled="true"
        android:exported="true" >
    </service>
)
The Services are inside my library.jar (compiled with slc)
 

DonManfred

Expert
Licensed User
Longtime User
I think i got it working using #extend in a Service like in this tutorial.
Both Services i could start from within B4A (there are two services in the app now. Both started successfully.
I could not further test it as i do not have such a reader here as of now (waiting for delivery).
But it all looks ok from what i could see. Ok, wenn i try to connect to a BT Device giving a wrong adress ("address" :D) i ran into an exception that this is not a valid mac address. Ok, Expected....

Need to investigate more but i´m positive
 
Top