java.lang.IllegalArgumentException: Service Vorsatz muss explizit sein: Absicht

Ich versuche eine Verbindung zu meinem android-app für ein MS Band und ich erhalte die folgende Fehlermeldung:

java.lang.IllegalArgumentException: Service Intent must be explicit: Intent { act=com.microsoft.band.service.action.BIND_BAND_SERVICE }

Den code-snippet, das ich verwende, ist wie folgt:

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) {

    }
}

Ich bin nach dem Beispiel in der Microsoft Band SDK, und ich bin neu in diesem. Jegliche Hilfe würde sehr geschätzt werden.

InformationsquelleAutor kasun61 | 2015-04-09
Schreibe einen Kommentar