Open a wear activity from a wear notification action button

178 Views Asked by At

All im trying to do is set it up so that when you click one of the action buttons on the notification it opens a wear activity ive looked up how to do this a bunch over the past day and i keep winding up with the same onconnected: null issue. i cant seem to progress past this problem thanks in advance for any help.

PutDataMapRequest dataMapRequest = PutDataMapRequest.create("/notification"); dataMapRequest.getDataMap().putDouble("timestamp", System.currentTimeMillis()); dataMapRequest.getDataMap().putString("title", "This is the title"); dataMapRequest.getDataMap().putString("content", "This is a notification with some text."); PutDataRequest putDataRequest = dataMapRequest.asPutDataRequest(); Wearable.DataApi.putDataItem(mGoogleApiClient, putDataRequest);

1

There are 1 best solutions below

2
On

About the GoogleApiClient being null at onConnected, try calling mGoogleApiClient.connect() at onStart and mGoogleApiClient.disconnect() at onStop, as adviced in the documentation.

If you have used enableAutoManage, also remove it as in this post.