Java Code Examples for com.google.android.gms.wearable.Wearable#NodeApi

The following examples show how to use com.google.android.gms.wearable.Wearable#NodeApi . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MainActivity.java    From AndroidWearable-Samples with Apache License 2.0 6 votes vote down vote up
@Override
public void onConnectionFailed(ConnectionResult result) {
    if (Log.isLoggable(TAG, Log.DEBUG)) {
        Log.d(TAG, "Disconnected from Google Api Service");
    }
    if (null != Wearable.NodeApi) {
        Wearable.NodeApi.removeListener(mGoogleApiClient, this);
    }
    if (mResolvingError) {
        // Already attempting to resolve an error.
        return;
    } else if (result.hasResolution()) {
        try {
            mResolvingError = true;
            result.startResolutionForResult(this, REQUEST_RESOLVE_ERROR);
        } catch (IntentSender.SendIntentException e) {
            // There was an error with the resolution intent. Try again.
            mGoogleApiClient.connect();
        }
    } else {
        mResolvingError = false;
    }
}
 
Example 2
Source File: Courier.java    From courier with Apache License 2.0 5 votes vote down vote up
/**
 * Attach a mock NodeApi for testing.
 *
 * @param mockNodeApi A custom NodeApi implementation to use instead of Wearable.NodeApi, or null to revert back to Wearable.NodeApi
 */
public static void attachMockNodeApi(@Nullable final NodeApi mockNodeApi) {
    if(mockNodeApi==null) {
        WearableApis.NodeApi = Wearable.NodeApi;
    } else {
        WearableApis.NodeApi = mockNodeApi;
    }
}
 
Example 3
Source File: WearableApis.java    From courier with Apache License 2.0 4 votes vote down vote up
/** For use by generated code, do not use */
public static boolean hasMockNodeApi() {
    return NodeApi!=Wearable.NodeApi;
}