Showing posts with label Android Wear. Show all posts
Showing posts with label Android Wear. Show all posts

Saturday, October 11, 2014

Wear Shell - Exploring Android Wear

Having a LG G Watch for a while I thought that it would be interesting to run code directly on the watch without having to create an APK. Sometimes I just wanted to run some code snippets on the watch and view the result instantly.
Creating a complete project, compiling and deploying the APK on the Wear device is quite time consuming and somewhat annoying.

I tried to write an app to execute BeanShell code directly on the Wear device. This is all experimental and the possibilities are quite limited compared to an regular app, but for an execution of some code snippets that seemed to be a good idea.

The result is Wear Shell, an app that consists of a mobile and a Wear part. The mobile part moves the code for execution to the smart watch, collects the result and passes it to the calling application.

So I hope owners of an Android Wear smart watch have fun with the app and find it as interesting as I did to explore things from the perspective of a watch.

WearShell App


Web Interface

To make tests easier, the app contains a small (PAW based) web server with a web interface. Inside this interface you can type the code inside a text area, press the Execute button and wait for the result to be displayed.

Web Interface with Wear System Information


The web interface also contains a page containing code snippets for you to try out. These snippets include code for database, Bluetooth and system info access and should provide a good starting point for further explorations.

Developers

Developers have the possibility to use the functionality of the app within their own applications by using a Result Intent.

Action: de.fun2code.android.wear.shell.EXEC
Request String Extra: bsh
Response String Extra: result

Just pass the BeanShell code to execute to the bsh parameter and read the result from the resulting Intent.

Links 

Download: WearShell APK
Discussion: XDA Developers

Tuesday, August 26, 2014

PirateBox for Android - Android Wear

Starting with version 0.53 PirateBox for Android supports Android Wear notifications for uploads and shout messages.

Android Wear support is disabled by default but can be enabled inside the PirateBox preferences. There is a new Android Wear section which currently only has one Wear Notification check-box preference.
As soon as this option is ticked upload and shout notifications will be sent to a connect Wear device.

Android Wear Preference

Whenever a new upload or shout has been processed and sent to the Wear device a notification is displayed on the Android device (the phone) to indicate that new notifications have been transferred to the Wear device. If that notification gets dismissed, all notifications on the smart-watch will also be deleted.

Wear Notification on Phone

On the smart-watch notifications are summarized and presented in chronological order (newer first). The following image describes the flow on the Wear device.

Flow on Wear Device

After the messages have been expanded options are available to open the PirateBox app on the phone and in the case of a file upload to open that file on your phone for display.

Thursday, March 27, 2014

A Look at Android Wear

Google released Android Wear a version of the Android OS specifically designed for wearable device like smart watches and the like.
Actual devices should follow shortly by the middle of this year starting with smart watches from Motorola and LG.

Along with the announcement of Android Wear Google released a preview version of the Android Wear SDK for developers to test and try the new OS.
Looking at the SDKs emulator and docs thing might look a little bit disappointing at first glance, if the expectation is that reals apps can be installed on an Android Wear device.
The Wear API is designed that the wearable device is showing notifications from an Android phone by using the since Android 4.3 Jelly Bean available Notification Access service. This service allows apps to receive information about notifications displayed on device notification bar. In earlier versions of Android this was only available by using the Accessibility feature of Android.

To connect a device to an Android Wear emulator, Google has provided an Android Wear Preview app for registered developers. Because using the above mentioned “Notification Access” service, this app only runs on devices with Android 4.3 or higher.
When the app is enabled all (non ongoing) notifications will be displayed on the Android Wear device with the ability to use rich notifications which allow to use action buttons for sending Intents back to the smart phone.
This design has the advantage that without any change current apps will work with Android Wear out of box.

The possibilities currently available with that notification approach are quite limited and can be viewed on the Android Wear developer page.

In summary developers can use the following notification types:

  • Rich notifications including images and action buttons
  • Grouped notifications
  • Notifications with multiple pages
  • Receive voice input from a notification


That seems to be it as far as the official API concerned. But the question arises (at least from a hacker’s perspective) … Can the Android Wear OS run regular apps?

If we have a look at the above linked developer page, it states:

“Caution: Do not install apps on the Android Wear emulator. The system does not support traditional Android apps and the result of running such apps is unpredictable.”

It is indeed possible to run apps with some exceptions. Network access is not possible and in the case of most apps will lead to a crash of the app. Web Views are also not supported. Apart from that, apps seem to work fine, but the small display size might be a problem.
Because this is a block for developers and hackers, let’s have a look how to run apps on the Android Device emulator.

First of all an APK of an app is needed that does not require network access. An example of such an app is the StopWatch & Timer app from Google Play.
The APK can be extracted from another Android device with a backup app. Using APK Backup of the PAW web interface is also an option.
The APK can be simply installed onto an emulator running Android Wear with the following command:

adb install

When the APK has been installed, the app StopWatch & Timer app can be started like this:

adb shell am start -n com.sportstracklive.stopwatch/com.sportstracklive.stopwatch.BigStopWatchActivity

After startup the app will show up on the emulator’s screen. Apart from the  small screen estate, the app seems to be working fine. Event the preference screen is working.

All in all Android Wear seems to be a nice addition to the Android family and summer seems to be getting interesting with new devices popping up.