SDK Example throws SecurityException: Binder invocation to an incorrect interface

I’ve build the S Pen Remote SDK Sample App - when pressing the “Connect” Button, I get the following expection on my Samsung Galaxy S22 Ultra

[...].sample.spenremote E/SpenRemoteSample: VersionCode=16777217
[...].sample.spenremote E/SpenRemoteSample: versionName=1.0.1
[...]t.sample.spenremote E/SpenRemoteSample: Support Button = true
[...].spenremote E/SpenRemoteSample: Support Air motion = true

[...].sample.spenremote E/SpenRemoteSample: connectToSpenRemote
[...].sample.spenremote D/SM_SDK: SPen Remote SDK version : 1.0.1
[...].sample.spenremote D/SM_SDK: bind SpenRemoteService
[...].sample.spenremote D/SM_SDK: SpenRemoteService : Connected!
[...].sample.spenremote E/SpenRemoteSample: onConnected
[...]/? W/Parcel: **** enforceInterface() expected ‘android.os.IMessenger’ but read ‘com.samsung.android.sdk.penremote.ISPenRemoteService’
[...].sample.spenremote E/SpenRemoteSample: unexpected error registering listener
java.lang.SecurityException: Binder invocation to an incorrect interface
at android.os.Parcel.createExceptionOrNull(Parcel.java:2437)
at android.os.Parcel.createException(Parcel.java:2421)
at android.os.Parcel.readException(Parcel.java:2404)
at android.os.Parcel.readException(Parcel.java:2346)
at com.samsung.android.sdk.penremote.ISPenRemoteService$Stub$Proxy.registerSpenEventListener(ISPenRemoteService.java:98)
at com.samsung.android.sdk.penremote.SpenUnit.setSpenEventListener(SpenUnit.java:47)
at com.samsung.android.sdk.penremote.SpenUnitManager.registerSpenEventListener(SpenUnitManager.java:89)
at [...].sample.spenremote.MainActivity$5.onSuccess(MainActivity.java:159)
at com.samsung.android.sdk.penremote.SpenRemote$1.onServiceConnected(SpenRemote.java:296)
at android.app.LoadedApk$ServiceDispatcher.doConnected(LoadedApk.java:2235)
at android.app.LoadedApk$ServiceDispatcher$RunConnection.run(LoadedApk.java:2268)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:226)
at android.os.Looper.loop(Looper.java:313)
at android.app.ActivityThread.main(ActivityThread.java:8646)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:567)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135)

I’ve upgraded the contained spenremote-v1.0.0.jar to sprenremote-v1.0.1.jar - but this did not solve the problem

Any help/hit would be appreciated,
Thanks, Christian

  • Hello, I think you might get better assistance if you submit a support request here

The issue seems to be fixed with the current software version - I can no longer reproduce this issue.

Thanks uh_1586406719 for the hint to contact support.

How you resolve this? I met exactly same error.

1 Like

I am facing the same problem, how did you manage to fix this ?

Sorry, I cannot reproduce the problem - SDK works as expected. All I did was to perform a security update on my phone.

I’ve tested it successfully today on S22 Ultra (Android 13, January security update) and Tab S8 Ultra (December security update)

Thanks for the reply, Luidolt,

I am running the S22 Ultra (Android 13, January security update) as well, and I managed to get it working.
All I did was make sure I have the S Pen Air action toggle on (otherwise the event for the button press was not emitted) and restarted my device.
After the restart, I was able to receive the button event as well as the motion data from my S Pen.

Hope this will be helpful for someone.