youssefhg
youssefhg

Reputation: 11

How to start an activity with a custom layout from Wearable when Handheld device receives a Push Notification

I am trying to launch an Activity form a Wearable device (watch) when a push notification is received on a handheld device.

I read in other questions that I will need to send data over to Wearable, then in the "onDataChanged" event I can build the notification from the wearable device and add a PendingIntent with the desired wearable activity. But in order to do that I will have to initialize and connect a GoogleAPIClient from the intent service on the handheld device that received the push nitification which is the part that I am kind of struggling with. Any help would be appreciated. Thanks.

Upvotes: 0

Views: 388

Answers (2)

youssefhg
youssefhg

Reputation: 11

Since I am trying to connect the ApiClient from a service that does not run on the UI thread I was able to do that

 mGoogleApiClient = new GoogleApiClient.Builder(context).addApi(Wearable.API).build();
 mGoogleApiClient.blockingConnect(30, TimeUnit.SECONDS);

And it worked fine.

Upvotes: 0

eshayne
eshayne

Reputation: 935

If you're looking for help getting started with the GoogleAPIClient, this may help.

Upvotes: 0

Related Questions