com.google.android.gms.wearable.Channel Java Examples

The following examples show how to use com.google.android.gms.wearable.Channel. 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: ListenerService.java    From xDrip with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onChannelOpened(final Channel channel) {
    UserError.Log.d(TAG, "onChannelOpened: A new channel opened. From Node ID: " + channel.getNodeId() + " Path: " + channel.getPath());

    switch (channel.getPath()) {

        case "/updated-apk":
            ProcessAPKChannelDownload.enqueueWork(googleApiClient, channel);
            break;
        default:
            UserError.Log.e(TAG, "Unknown channel: " + channel.getPath());
    }
}
 
Example #2
Source File: ListenerService.java    From xDrip with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onChannelClosed(final Channel channel, final int closeReason, final int appSpecificErrorCode) {
    logChannelCloseReason("Whole Channel", channel, closeReason, appSpecificErrorCode);
    // TODO counter for failures??
    if ((closeReason == CLOSE_REASON_LOCAL_CLOSE || closeReason == CLOSE_REASON_REMOTE_CLOSE) && reRequestDownloadApkCounter < 30 && apkBytesRead < 1 && appSpecificErrorCode == 0) {
        UserError.Log.d(TAG,"Requesting to download again");
        reRequestDownloadApkCounter++;
        Inevitable.task("re-request apk download on close", 16000, VersionFixer::downloadApk);
    }
}
 
Example #3
Source File: ProcessAPKChannelDownload.java    From xDrip with GNU General Public License v3.0 5 votes vote down vote up
static synchronized void enqueueWork(final GoogleApiClient client, final Channel current_channel) {
    UserError.Log.d(TAG, "EnqueueWork enter");
    if (client == null || current_channel == null) {
        UserError.Log.d(TAG, "Enqueue Work: Null input data!!");
        return;
    }
    googleApiClient = client;
    channel = current_channel;
    enqueueWork(xdrip.getAppContext(), ProcessAPKChannelDownload.class, Constants.APK_DOWNLOAD_JOB_ID, new Intent());
}
 
Example #4
Source File: ListenerService.java    From xDrip-plus with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onChannelOpened(final Channel channel) {
    UserError.Log.d(TAG, "onChannelOpened: A new channel opened. From Node ID: " + channel.getNodeId() + " Path: " + channel.getPath());

    switch (channel.getPath()) {

        case "/updated-apk":
            ProcessAPKChannelDownload.enqueueWork(googleApiClient, channel);
            break;
        default:
            UserError.Log.e(TAG, "Unknown channel: " + channel.getPath());
    }
}
 
Example #5
Source File: ListenerService.java    From xDrip-plus with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onChannelClosed(final Channel channel, final int closeReason, final int appSpecificErrorCode) {
    logChannelCloseReason("Whole Channel", channel, closeReason, appSpecificErrorCode);
    // TODO counter for failures??
    if ((closeReason == CLOSE_REASON_LOCAL_CLOSE || closeReason == CLOSE_REASON_REMOTE_CLOSE) && reRequestDownloadApkCounter < 30 && apkBytesRead < 1 && appSpecificErrorCode == 0) {
        UserError.Log.d(TAG,"Requesting to download again");
        reRequestDownloadApkCounter++;
        Inevitable.task("re-request apk download on close", 16000, VersionFixer::downloadApk);
    }
}
 
Example #6
Source File: ProcessAPKChannelDownload.java    From xDrip-plus with GNU General Public License v3.0 5 votes vote down vote up
static synchronized void enqueueWork(final GoogleApiClient client, final Channel current_channel) {
    UserError.Log.d(TAG, "EnqueueWork enter");
    if (client == null || current_channel == null) {
        UserError.Log.d(TAG, "Enqueue Work: Null input data!!");
        return;
    }
    googleApiClient = client;
    channel = current_channel;
    enqueueWork(xdrip.getAppContext(), ProcessAPKChannelDownload.class, Constants.APK_DOWNLOAD_JOB_ID, new Intent());
}
 
Example #7
Source File: ListenerService.java    From xDrip with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void onInputClosed(final Channel channel, final int closeReason, final int appSpecificErrorCode) {
    logChannelCloseReason("Channel input", channel, closeReason, appSpecificErrorCode);
}
 
Example #8
Source File: ListenerService.java    From xDrip with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void onOutputClosed(final Channel channel, final int closeReason, final int appSpecificErrorCode) {
    logChannelCloseReason("Channel output", channel, closeReason, appSpecificErrorCode);
}
 
Example #9
Source File: ListenerService.java    From xDrip with GNU General Public License v3.0 4 votes vote down vote up
private void logChannelCloseReason(String source, final Channel channel, final int closeReason, final int appSpecificErrorCode) {
    UserError.Log.d(TAG, source + " closed. Reason: " + getCloseReason(closeReason) + " (" + closeReason + ") Error code: " + appSpecificErrorCode + " From Node ID " + channel.getNodeId() + " Path: " + channel.getPath());
}
 
Example #10
Source File: ListenerService.java    From xDrip-plus with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void onInputClosed(final Channel channel, final int closeReason, final int appSpecificErrorCode) {
    logChannelCloseReason("Channel input", channel, closeReason, appSpecificErrorCode);
}
 
Example #11
Source File: ListenerService.java    From xDrip-plus with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void onOutputClosed(final Channel channel, final int closeReason, final int appSpecificErrorCode) {
    logChannelCloseReason("Channel output", channel, closeReason, appSpecificErrorCode);
}
 
Example #12
Source File: ListenerService.java    From xDrip-plus with GNU General Public License v3.0 4 votes vote down vote up
private void logChannelCloseReason(String source, final Channel channel, final int closeReason, final int appSpecificErrorCode) {
    UserError.Log.d(TAG, source + " closed. Reason: " + getCloseReason(closeReason) + " (" + closeReason + ") Error code: " + appSpecificErrorCode + " From Node ID " + channel.getNodeId() + " Path: " + channel.getPath());
}
 
Example #13
Source File: CrossbowListenerService.java    From CrossBow with Apache License 2.0 4 votes vote down vote up
@Override
@CallSuper
public void onChannelOpened(Channel channel) {
}
 
Example #14
Source File: CrossbowListenerService.java    From CrossBow with Apache License 2.0 4 votes vote down vote up
@Override
@CallSuper
public void onChannelClosed(Channel channel, int closeReason, int appSpecificErrorCode) {
}
 
Example #15
Source File: CrossbowListenerService.java    From CrossBow with Apache License 2.0 4 votes vote down vote up
@Override
@CallSuper
public void onInputClosed(Channel channel, int closeReason, int appSpecificErrorCode) {
}
 
Example #16
Source File: CrossbowListenerService.java    From CrossBow with Apache License 2.0 4 votes vote down vote up
@Override
@CallSuper
public void onOutputClosed(Channel channel, int closeReason, int appSpecificErrorCode) {
}