Problem in onServiceConected in an Android Service
Hi,
public void onServiceConnected(ComponentName name, IBinder service) {
----> serviceBinder = (BtleService.LocalBinder) service; <----
mwBoard = serviceBinder.getMetaWearBoard(btDevice);
}
I'm having a problem trying to use the board in an Android Service.
I've created a service, which is running in another process, not in the app's process, but I have an error in the onServiceConnected which says:
"java.lang.ClassCastException: android.os.BinderProxy cannot be cast to com.mbientlab.metawear.android.BtleService$LocalBinder"
That error is in this line:
public void onServiceConnected(ComponentName name, IBinder service) {
----> serviceBinder = (BtleService.LocalBinder) service; <----
mwBoard = serviceBinder.getMetaWearBoard(btDevice);
}
I don't know how to solve this,
any idea? Thanks.
any idea? Thanks.
This discussion has been closed.
Comments
service
variable is a BinderProxy type so you have to cast it to the BinderProxy class, not the BtleService.LocalBinder class.