Quantcast
Channel: Mobileapptelligence.com » Android Developers
Viewing all articles
Browse latest Browse all 30

How To Develop Wearable App on Native Android Platform?

$
0
0

Wearable devices can run directly on any wearable device. It gives access to certain low-level hardware like services, activities, sensors and more. It is important that the wearable app should contain companion app before it gets released to the Google Play store. Because the wearable apps are not supported by Google Play store and only handheld apps can be downloaded by the users.  The handheld app can also be used for heavy processing or network actions and it can send the results to the wearable.

Develop wearable app

Develop wearable app

 

Points to Remember Before Building Wearable Apps

Update your SDK with Android 4.4W.2 (API 20) or higher

         The updated platform version provides new APIs for wearable apps.

Update your SDK tools to version 23.0.0 or higher

         The updated SDK tools enable you to build and test wearable apps.

Create a Project

To begin app development, create an app project that contains wearable and handheld app modules. In Android Studio, click File > New Project and follow the Project Wizard instructions, as described in Creating a Project. As you follow the wizard, enter the following information:

In the Configure, your Project window, enter a name for your app and a package name.

In the Form Factors window:

  • Select Phone and Tablet and select API 9: Android 2.3 (Gingerbread) under Minimum SDK.
  • Select Wear and select API 20: Android 4.4 (KitKat Wear) under Minimum SDK.
  • In the first Add an Activity window, add a blank activity for mobile.
  • In the second Add an Activity window, add a blank activity for Wear.

 

When the wizard completes, Android Studio creates a new project with two modules, mobile, and wear. You now have a project for both your handheld and wearable apps for which you can create activities, services, and custom layouts. The handheld app does most of the heavy lifting, such as network communications, intensive processing, or tasks that require long amounts of user interaction. When the app completes these operations, your app should notify the wearable of the results through notifications or by syncing and sending data to the wearable.

Install the Wearable App

When developing, you install apps directly to the wearable like with handheld apps. Use either add install or the Play button on Android Studio.

Develop wearable app

Develop wearable app

When you’re ready to publish your app to users, you embed the wearable app inside of the handheld app. When a user installs the handheld app from Google Play, a connected wearable automatically receives the wearable app.

To install the “Hello World” app to the wearable, select wear from the Run/Debug configuration drop-down menu and click the Play button. The activity shows up on the wearable and prints out “Hello world!”

Include the Correct Libraries

As part of the Project Wizard, the correct dependencies are imported for you in the appropriate module’s build.gradle file. However, these dependencies are not required, so read the following descriptions to find out if you need them or not:

Notifications

The Android v4 support library (or v13, which includes v4) contains the APIs to extend your existing notifications on handhelds to support wearable. For notifications that appear only on the wearable (meaning, they are issued by an app that runs on the wearable), you can just use the standard framework APIs (API Level 20) on the wearable and remove the support library dependency in the mobile module of your project.

Wearable Data Layer

To sync and send data between wearable and handhelds with the Wearable Data Layer APIs, you need the latest version of Google Play services. If you’re not using these APIs, remove the dependency from both modules.

Wearable UI support library

This is an unofficial library that includes UI widgets designed for wearable. We encourage you to use them in your apps because they exemplify best practices, but they can still change at any time. However, if the libraries are updated, the mobile apps developed by you, won’t break since they are compiled into your app. To get new features from an updated library, you just need to statically link the new version and update your app accordingly. This library is only applicable if you create wearable apps.

The post How To Develop Wearable App on Native Android Platform? appeared first on Mobileapptelligence.com.


Viewing all articles
Browse latest Browse all 30

Trending Articles