make your existing app android wear compatible

Post on 28-Jul-2015

328 Views

Category:

Mobile

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Android WearYep, it is wearable anymore!

Who am I?

Co-Founder / CEO of

Android&iOS Developer

Member of GDG Ankara

Android Evangelist

ADD ‘15

Wearables are

EverywhereYou can catch the trend

with Android Wear!

It is easy to implement

Notifications

If you send your notifications to your app, it appears on Wear, too!

Only if you use NotificationCompat class

Example

pI = PendingIntent.getActivity(this, 0, new Intent(this,MainActivity.class), 0);pIExtra = PendingIntent.getActivity(this, 0, new Intent(Intent.ACTION_DIAL),0);

Example

NotificationCompat.Action action = new NotificationCompat.Action.Builder(android.R.drawable.ic_btn_speak_now, "Reply!",pIExtra).build();

Example

NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this) .setSmallIcon(R.mipmap.ic_launcher) .setContentTitle("TEST") .setContentText("Test Mesasge!") .extend(new NotificationCompat.WearableExtender().addAction(action));

mBuilder.setContentIntent(pI);mBuilder.setDefaults(Notification.DEFAULT_SOUND);mBuilder.setAutoCancel(true);NotificationManager mNotificationManager = (NotificationManager)this.getSystemService(Context.NOTIFICATION_SERVICE);mNotificationManager.notify(1, mBuilder.build());

Example

It will be shown on the handset as usual.

But if an Android Wear is connected to the handset, it will be look like this! >

Android Wear Apps

EVEN

Setting Up!

Wear Emulator&

Android DeviceCreate an Android Wear emulator

Install Android Wear app to your phone

Connect your phone to your computer

Open up Terminal and make the port forwarding via this command: adb -d forward tcp:5601 tcp:5601

Run the Android Wear Emulator and select “pair with emulator” option from Android Wear app

It is DONE!You can start to develop for Android Wear, now!

A little DEMO! :)

Thank You!Let’s keep in touch@orhunmertsimsek

mert@4pps.co

top related