ServiceConnection and MetaWear
Hi,
I have a class "MetaWear" that extends ListActivity and implements ServiceConnection.
So, I have implemented the Bluetooth well (in fact, I'm able to find the MetaWear) but, I have a problem with the implementation of ServiceConnection.
I have seen some docs but I have still some problems.
I have seen some docs but I have still some problems.
For example when I implement onServiceConnection the doc suggest:
private MetaWearBleService mwService;
public void onServiceConnected(ComponentName name, IBinder service) {
mwService= ((MetaWearBleService.LocalBinder) service).getService();
}
When I write it, Android studio told me that cannot resolve "getService()" but I don't understand why.
What I want to do is create a connection with the BluetoothDevice discovered (the MetaWear found).
This discussion has been closed.
Comments
MetaWearBleService.LocalBinder binder;
binder = (MetaWearBleService.LocalBinder) service;
I have forget to add:
"getApplicationContext().bindService(new Intent(this, MetaWearBleService.class), this, Context.BIND_AUTO_CREATE);"