Hello,
I´m trying to integrate an external sdk into a B4A-Application that allows a login by Identity Card via NFC. The sdk´s documentation (Table of contents — AusweisApp2 SDK 1.22.1 documentation (bund.de)) provides some snippets in Java to implement its features. I´m not very familiar with Java but I managed to establish a connection and pass/ receive commands in Android Studio. But with B4A I got stucked: BindService() returns false and onServiceConnection is never called .
This is the Inline Java:
in B4A:
What am I doing wrong? I declared the service in the manifest like this:
<service android:name="com.governikus.ausweisapp2.AusweisApp2Service" android:enabled="true"/>
Hopefully somebody here can point me to the right direction. Thanks
I´m trying to integrate an external sdk into a B4A-Application that allows a login by Identity Card via NFC. The sdk´s documentation (Table of contents — AusweisApp2 SDK 1.22.1 documentation (bund.de)) provides some snippets in Java to implement its features. I´m not very familiar with Java but I managed to establish a connection and pass/ receive commands in Android Studio. But with B4A I got stucked: BindService() returns false and onServiceConnection is never called .
This is the Inline Java:
Java:
import com.governikus.ausweisapp2.IAusweisApp2Sdk;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.os.IBinder;
IAusweisApp2Sdk mSdk;
boolean bound = false;
public void init() {
Intent serviceIntent = new Intent("com.governikus.ausweisapp2.START_SERVICE");
serviceIntent.setPackage("b4a.example");
getApplicationContext().bindService(serviceIntent, mServiceConnection, Context.BIND_AUTO_CREATE);
}
public boolean isBound() {
return bound;
}
ServiceConnection mServiceConnection = new ServiceConnection() {
@Override
public void onServiceConnected(ComponentName componentName, IBinder service) {
mSdk = IAusweisApp2Sdk.Stub.asInterface(service);
bound = true;
}
@Override
public void onServiceDisconnected(ComponentName componentName) {
mSdk = null;
bound = false;
}
};
in B4A:
B4X:
Dim jo As JavaObject
jo.InitializeContext
jo.RunMethod("init", Null)
Log(jo.RunMethod("isBound", Null))
What am I doing wrong? I declared the service in the manifest like this:
<service android:name="com.governikus.ausweisapp2.AusweisApp2Service" android:enabled="true"/>
Hopefully somebody here can point me to the right direction. Thanks