Java Code Examples for com.google.android.gms.wearable.DataApi#DeleteDataItemsResult
The following examples show how to use
com.google.android.gms.wearable.DataApi#DeleteDataItemsResult .
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: Message.java From DronesWear with BSD 3-Clause "New" or "Revised" License | 5 votes |
public static PendingResult<DataApi.DeleteDataItemsResult> sendEmptyAcceleroMessage(GoogleApiClient googleApiClient) { PendingResult<DataApi.DeleteDataItemsResult> pendingResult = null; if (acceleroMessageUri != null) { pendingResult = Wearable.DataApi.deleteDataItems(googleApiClient, acceleroMessageUri); } return pendingResult; }
Example 2
Source File: Message.java From DronesWear with BSD 3-Clause "New" or "Revised" License | 5 votes |
public static PendingResult<DataApi.DeleteDataItemsResult> sendEmptyJoystickMessage(GoogleApiClient googleApiClient) { PendingResult<DataApi.DeleteDataItemsResult> pendingResult = null; if (joystickMessageUri != null) { pendingResult = Wearable.DataApi.deleteDataItems(googleApiClient, joystickMessageUri); } return pendingResult; }
Example 3
Source File: Message.java From DronesWear with BSD 3-Clause "New" or "Revised" License | 5 votes |
public static PendingResult<DataApi.DeleteDataItemsResult> emptyActionMessage(GoogleApiClient googleApiClient) { PendingResult<DataApi.DeleteDataItemsResult> pendingResult = null; if (actionMessageUri != null) { pendingResult = Wearable.DataApi.deleteDataItems(googleApiClient, actionMessageUri); } return pendingResult; }
Example 4
Source File: UARTConfigurationSynchronizer.java From Android-nRF-Toolbox with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * Synchronizes the UART configurations between handheld and wearables. * Call this when configuration has been deleted. * @return pending result */ @SuppressWarnings("UnusedReturnValue") public PendingResult<DataApi.DeleteDataItemsResult> onConfigurationDeleted(final long id) { if (!hasConnectedApi()) return null; return Wearable.DataApi.deleteDataItems(googleApiClient, id2Uri(id)); }
Example 5
Source File: NotificationUpdateService.java From android-SynchronizedNotifications with Apache License 2.0 | 5 votes |
@Override public void onResult(DataApi.DeleteDataItemsResult deleteDataItemsResult) { if (!deleteDataItemsResult.getStatus().isSuccess()) { Log.e(TAG, "dismissWearableNotification(): failed to delete DataItem"); } mGoogleApiClient.disconnect(); }
Example 6
Source File: DismissListener.java From android-SynchronizedNotifications with Apache License 2.0 | 5 votes |
@Override // ResultCallback<DataApi.DeleteDataItemsResult> public void onResult(DataApi.DeleteDataItemsResult deleteDataItemsResult) { if (!deleteDataItemsResult.getStatus().isSuccess()) { Log.e(TAG, "dismissWearableNotification(): failed to delete DataItem"); } mGoogleApiClient.disconnect(); }
Example 7
Source File: CheckInAndDeleteDataItemsService.java From android-Geofencing with Apache License 2.0 | 5 votes |
@Override protected void onHandleIntent(Intent intent) { if (ACTION_CHECK_IN.equals(intent.getAction())) { // In a real app, code for checking in would go here. For this sample, we will simply // display a success animation. startConfirmationActivity(ConfirmationActivity.SUCCESS_ANIMATION, getString(R.string.check_in_success)); // Dismiss the check-in notification. ((NotificationManager) getSystemService(NOTIFICATION_SERVICE)).cancel(NOTIFICATION_ID); } else if (!ACTION_DELETE_DATA_ITEM.equals(intent.getAction())) { // The only possible actions should be checking in or dismissing the notification // (which causes an intent with ACTION_DELETE_DATA_ITEM). Log.e(TAG, "Unrecognized action: " + intent.getAction()); return; } // Regardless of the action, delete the DataItem (we are only be handling intents // if the notification is dismissed or if the user has chosen to check in, either of which // would be completed at this point). mGoogleApiClient.blockingConnect(CONNECTION_TIME_OUT_MS, TimeUnit.MILLISECONDS); Uri dataItemUri = intent.getData(); if (mGoogleApiClient.isConnected()) { DataApi.DeleteDataItemsResult result = Wearable.DataApi .deleteDataItems(mGoogleApiClient, dataItemUri).await(); if (!result.getStatus().isSuccess()) { Log.e(TAG, "CheckInAndDeleteDataItemsService.onHandleIntent: " + "Failed to delete dataItem: " + dataItemUri); } else if (Log.isLoggable(TAG, Log.DEBUG)) { Log.d(TAG, "Successfully deleted data item: " + dataItemUri); } } else { Log.e(TAG, "Failed to delete data item: " + dataItemUri + " - Client disconnected from Google Play Services"); } mGoogleApiClient.disconnect(); }
Example 8
Source File: NotificationUpdateService.java From AndroidWearable-Samples with Apache License 2.0 | 5 votes |
@Override public void onResult(DataApi.DeleteDataItemsResult deleteDataItemsResult) { if (!deleteDataItemsResult.getStatus().isSuccess()) { Log.e(TAG, "dismissWearableNotification(): failed to delete DataItem"); } mGoogleApiClient.disconnect(); }
Example 9
Source File: DismissListener.java From AndroidWearable-Samples with Apache License 2.0 | 5 votes |
@Override // ResultCallback<DataApi.DeleteDataItemsResult> public void onResult(DataApi.DeleteDataItemsResult deleteDataItemsResult) { if (!deleteDataItemsResult.getStatus().isSuccess()) { Log.e(TAG, "dismissWearableNotification(): failed to delete DataItem"); } mGoogleApiClient.disconnect(); }
Example 10
Source File: CheckInAndDeleteDataItemsService.java From AndroidWearable-Samples with Apache License 2.0 | 5 votes |
@Override protected void onHandleIntent(Intent intent) { if (ACTION_CHECK_IN.equals(intent.getAction())) { // In a real app, code for checking in would go here. For this sample, we will simply // display a success animation. startConfirmationActivity(ConfirmationActivity.SUCCESS_ANIMATION, getString(R.string.check_in_success)); // Dismiss the check-in notification. ((NotificationManager) getSystemService(NOTIFICATION_SERVICE)).cancel(NOTIFICATION_ID); } else if (!ACTION_DELETE_DATA_ITEM.equals(intent.getAction())) { // The only possible actions should be checking in or dismissing the notification // (which causes an intent with ACTION_DELETE_DATA_ITEM). Log.e(TAG, "Unrecognized action: " + intent.getAction()); return; } // Regardless of the action, delete the DataItem (we are only be handling intents // if the notification is dismissed or if the user has chosen to check in, either of which // would be completed at this point). mGoogleApiClient.blockingConnect(CONNECTION_TIME_OUT_MS, TimeUnit.MILLISECONDS); Uri dataItemUri = intent.getData(); if (mGoogleApiClient.isConnected()) { DataApi.DeleteDataItemsResult result = Wearable.DataApi .deleteDataItems(mGoogleApiClient, dataItemUri).await(); if (!result.getStatus().isSuccess()) { Log.e(TAG, "CheckInAndDeleteDataItemsService.onHandleIntent: " + "Failed to delete dataItem: " + dataItemUri); } else if (Log.isLoggable(TAG, Log.DEBUG)) { Log.d(TAG, "Successfully deleted data item: " + dataItemUri); } } else { Log.e(TAG, "Failed to delete data item: " + dataItemUri + " - Client disconnected from Google Play Services"); } mGoogleApiClient.disconnect(); }
Example 11
Source File: DeleteService.java From AndroidWearable-Samples with Apache License 2.0 | 5 votes |
@Override protected void onHandleIntent(Intent intent) { mGoogleApiClient.blockingConnect(TIME_OUT, TimeUnit.MILLISECONDS); Uri dataItemUri = intent.getData(); if (Log.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, "DeleteService.onHandleIntent=" + dataItemUri); } if (mGoogleApiClient.isConnected()) { DataApi.DeleteDataItemsResult result = Wearable.DataApi .deleteDataItems(mGoogleApiClient, dataItemUri).await(); if (result.getStatus().isSuccess() && !intent.getBooleanExtra(EXTRA_SILENT, false)) { // Show the success animation on the watch unless Silent extra is true. startConfirmationActivity(ConfirmationActivity.SUCCESS_ANIMATION, getString(R.string.delete_successful)); } else { if (Log.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, "DeleteService.onHandleIntent: Failed to delete dataItem:" + dataItemUri); } // Show the failure animation on the watch unless Silent extra is true. if (!intent.getBooleanExtra(EXTRA_SILENT, false)) { startConfirmationActivity(ConfirmationActivity.FAILURE_ANIMATION, getString(R.string.delete_unsuccessful)); } } } else { Log.e(TAG, "Failed to delete data item: " + dataItemUri + " - Client disconnected from Google Play Services"); // Show the failure animation on the watch unless Silent extra is true. if (!intent.getBooleanExtra(EXTRA_SILENT, false)) { startConfirmationActivity(ConfirmationActivity.FAILURE_ANIMATION, getString(R.string.delete_unsuccessful)); } } mGoogleApiClient.disconnect(); }