Bhavana
Bhavana

Reputation: 239

Android wear : how to support existing app to Android wear

I have installed new android wear SDK. Also have downloaded Android wear app from play store on my phone. I am able to connect my phone with Android wear simulator.

Now I want to give android wear support to an exisitng app. How do I achieve this?

Thanks in advance.

Upvotes: 23

Views: 8549

Answers (3)

promanowicz
promanowicz

Reputation: 429

If anyone would still struggle the issue.

Short answer. Add this feature to your app manifest:

<uses-feature android:name="android.hardware.type.watch" />

Longer answer. It depends. I'm assuming that you have a mobile app, and you just want to to publish for the wear. In that case you need to create separate flavor of your app, which includes the feature from above and changes the target API. FYI Wear ecosystem is a bit different from mobile, ex before 23 there is no direct internet access, no keyboard and no accounts. So you probably want to target minApi 23 for wear flavor.

Further reading: https://developer.android.com/training/wearables/apps/standalone-apps

Upvotes: 2

Aniket Thakur
Aniket Thakur

Reputation: 69025

There are two parts to adding a wear module to existing android app. 1. Adding the module itself 2. Packaging it with existing android module

Marty has already explained the 1st part let me add details of the 2nd one -

  1. Include all the permissions declared in the manifest file of the wearable app module in the manifest file of the handheld app module.
  2. Ensure that both the wearable and handheld app modules have the same package name and version number.
  3. Declare a Gradle dependency in the handheld app's build.gradle file that points to the wearable app module:

dependencies { compile 'com.google.android.gms:play-services:5.0.+@aar' compile 'com.android.support:support-v4:20.0.+'' wearApp project(':wearable') }

References

  1. https://developer.android.com/studio/projects/add-app-module.html
  2. https://developer.android.com/training/wearables/apps/packaging.html

Upvotes: 4

Marty Miller
Marty Miller

Reputation: 1081

You need to import an Android Wear module. Right click on the your project and select "Open Module Settings" Then click the "plus" button which should bring up a wizard to add a Wear Module.

Upvotes: 16

Related Questions