Skip to content

Commit

Permalink
Added Wear Messaging API demo
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul Ruiz committed Sep 30, 2014
1 parent 7a2f1a0 commit d396477
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ Wear: Examples of possible notifications using the Google Wear developer preview

WearCustomWatchFace: Creates a custom watch face for the Android Wear with a settings activity. Uses an undocumented API, but I'll have a sample up when an official API is available.

WearMessageApi: Demonstration of communication between a smartphone and Android Wear device through the Wearable Message API. Article describing the demo can be found at www.binpress.com/tutorials

------------------------------------------------------------------------------------------------

License
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import com.google.android.gms.wearable.Wearable;


public class MainActivity extends Activity {
public class MainActivity extends Activity implements GoogleApiClient.ConnectionCallbacks {

private static final String START_ACTIVITY = "/start_activity";
private static final String WEAR_MESSAGE_PATH = "/message";
Expand All @@ -36,7 +36,6 @@ protected void onCreate(Bundle savedInstanceState) {

init();
initGoogleApiClient();
sendMessage(START_ACTIVITY, "");
}

private void initGoogleApiClient() {
Expand Down Expand Up @@ -94,4 +93,14 @@ public void run() {
}
}).start();
}

@Override
public void onConnected(Bundle bundle) {
sendMessage(START_ACTIVITY, "");
}

@Override
public void onConnectionSuspended(int i) {

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import android.app.Activity;
import android.os.Bundle;
import android.view.WindowManager;
import android.widget.ArrayAdapter;
import android.widget.ListView;

Expand All @@ -27,6 +28,8 @@ protected void onCreate(Bundle savedInstanceState) {
mAdapter = new ArrayAdapter<String>( this, R.layout.list_item );
mListView.setAdapter( mAdapter );

getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);

initGoogleApiClient();
}

Expand Down

0 comments on commit d396477

Please sign in to comment.