I am trying to connect my android app to an MS Band and the I am getting the following error:
java.lang.IllegalArgumentException: Service Intent must be explicit: Intent { act=com.microsoft.band.service.action.BIND_BAND_SERVICE }
The code snippet I am using is as follows:
private View.OnClickListener mButtonConnectClickListener = new View.OnClickListener() {
@Override
public void onClick(View button) {
pairedBands = BandClientManager.getInstance().getPairedBands();
bandClient = BandClientManager.getInstance().create(getApplicationContext(), pairedBands[0]);
// Connect must be called on a background thread.
new ConnectTask().execute();
}
};
private class ConnectTask extends AsyncTask<BandClient, Void, Void> {
@Override
protected Void doInBackground(BandClient... clientParams) {
BandPendingResult<ConnectionResult> pendingResult = null;
try {
pendingResult = bandClient.connect();
} catch (BandIOException e) {
e.printStackTrace();
}
try {
ConnectionResult result = pendingResult.await();
if(result == ConnectionResult.OK) {
BandConnection.setText("Connection Worked");
} else {
BandConnection.setText("Connection Failed");
}
} catch(InterruptedException ex) {
// handle InterruptedException
} catch(BandException ex) {
// handle BandException
}
return null;
}
protected void onPostExecute(Void result) {
}
}
I am following the example given in the Microsft Band SDK, and I am new to this. Any help would be greatly appreciated.