Protection of Children in context of IHL and Counter Terrorism
Android wear notes
1. [TUTORIAL] How to develop Android Wear apps for
Beginners. Part 1 - Setup
AndroidWear
apps tutorial androidwear dev
calmarj
Jan 16
13
Android Wear is a new version of the Android system designed specifically for wearables , which
was announced by Google in march 2014. Currently lots of devices running on Android Wear were
released, including well designed Moto 360 and Gear Live by Samsung.But still, amount of
applications using all the benefits of Android Wear in Google Play is considerably small.
In this tutorial I'm going to show you how to create apps for Android Wear from Scratch.
Set up the Android development environment
Studying every new technology begins with launching "Hello World" example. But first you need to
set your development environment.
JDK – development kit for Java programming language
Android Studio – IDE to make our Android apps
Android SDK – special development kit for Android development
Android Virtual Device – emulator to test our apps
JDK
Android applications are usually developed in Java programming language using the Software
Development Kit. That's why we need to download SDK for working with Java.
1) Download the Java SE Development Kit (JDK) from this
site:http://www.oracle.com/technetwork/java/javase/downloads/175
2) Click Download from the JDK section of the 'Java Platform, Standard Edition' table.
3) Install the JDK environment with default setting
You can find more detailed instruction here:
http://www.oracle.com/technetwork/java/javase/index-137561.html24
2. Android Studio
Google developed its own environment for Android applications with lots of perks for development.
You can download it here: http://developer.android.com/sdk/index.html190
Here are steps for installation Android Studio on Windows and Linux. For MAC they are pretty
similar.
Installation for Windows:
1) Download and run **android-studio-bundle-(your version).exe**, then click on the "Next" button.
2) Leave all default settings untouched and click the **"Next"** button.
3. 3) Agree with all license agreements and click the "Next" button.
4.
5. 4) Choose a path where to install Android Studio and Android SDK.(**Please note**: use only ASCII
characters - english letters)
5) Android SDK includes Android device emulator. It means you can use emulator when you don't
have Android Wear Watch. I'm going to use emulator in this tutorial. Emulator for Windows requires
installation of the Intel Hardware Accelerated Execution Manager (Intel HAXM).
In this window you can adjust the amount of memory avaliable for HAXM. Leave it recommended
and click the "Next" button.
6. 6) Select or create a folder in which you would like to create the program's shortcut.
7. 7) Now the installation of Android Studio begins. Required time depends on your computer. For me it
took about half an hour. Next click on the «Finish» button.
8. 2q3B44znmHQ.jpg797x606 62.5 KB
Installation for Linux:
Download android-studio-ide-(your-version)-linux.zip. Unzip it (Please note: don't use non ASCII
characters in istallation path). Open terminal, go to Android Studio folder, then go the bin folder
and runstudio.sh script. These steps you can see in the screenshot for my system - Ubuntu 14.10.
9. qf46TCrt7zY.jpg722x462 35.4 KB
Android SDK
The start window of Android Studio should appear after the installation.(click on created shortcut if
the start window did not appear(for Windows) or run script studio.sh(for Linux)). Android platform
includes systems for phones, tvs and watches, so we need to download special development toolkit
for Android Wear. Click on"Configure" button and turn on SDK Manager.
10. TEPyZZOW_eI.jpg807x617 51.4 KB
If you want to test your applications on emulator, you also need to download virtual images, (Intel
x86 images will work faster). I recommend you to download samples for SDK, we are going to study
them later. If you want to test your application for different Android Wear versions, you need to
download SDK and virtual image for Android 4.4. Don't change default settings (so USB driver will
be installed. It maintains correct plugging a device into a computer.) Next click on "Install" button and
agree with licence agreement.
11. H7Ui-u42yjQ.jpg531x807 115 KB
SDK installation can take a while(about couple of hours).
Creating new project
Having downloaded SDK, we move to creating your first Android Wear application. More precisely
we are going to study one of the samples provided by Google.
1. Run Android Studio and Click Option «Import an Android code sample»
12. l71AnjZ637E.jpg797x606 65.4 KB
2. Type "Wear" in the searching box and choose "Skeleton Wearable App". Then click on
the "Next"button.
13. r5MLKA-KOOE.jpg807x492 38.4 KB
3. Now you can choose the name and path of your project. (Please note: don't change it unless
there are non ASCII characters) and click "Finish":
14. ISlD7htljss.jpg807x489 31.2 KB
4. Wait till the project is downloaded and built.
Please notice:
If you can see the error like:
"Failed to import new Gradle project: failed to find Build Tools revision xx.xx.xx "
then you don't have the latest version of the build tool. One of the main benefits of Android
Studio is that it can do menial work. Just click on "Install and sync project".
Your first project is done.
Now we need a watch to test an application. You can use an emulator if you don't have a watch.
Set up an Android Wear Virtual Device(AVD)
1. Click Tools>Android>AVD Manager or click on corresponding button in the panel:
15. cne4wz9gQVY.jpg807x489 30.2 KB
2. Click Create Virtual Device and after that choose category Wear in List and
select Square or Round Android Wear(you can see that Iselected Round) and click "Next":
16. 1Bf0CYYLM2w.jpg807x492 38 KB
3. Choose Android Wear version(I chose Lollipop for this tutorial, because it's the latest version and
most user-friendly, in my opinion.) and click "Next":
17. WToOaF9mxUU.jpg807x484 41.4 KB
4. Now you can change name of your AVD (I named it Smartwatch tutorial),choice of screen or
firmware. Also you can turn on Host GPU (better do it, that way the emulator will use computer
video card for rendering).
You can also turn on "Store a snapshot for faster startup". It lets AVD Manager to save
system state on hard disk after you finish working with emulator. It allows you to run the
emulator faster, because any Android emulator runs really slow(except third-party emulators,
like Genomytion)
After you finish setting click on the "Finish" button.
19. fr9lLTI-Vck.jpg807x431 25.4 KB
6. Now you can run the emulator, it can take a while. After that you can study how to work with
Android Wear following instructions.
20. Run the app
We need to set startup configuration to run this app. Click a field left from "Run", there you
can "Edit Configuration" or choose module to run.Choose "Wearable"(because we are going
to run the application for watches) and click on "Run".
Now we can see the list of devices ready for the application to be installed on. Choose the
emulator we created early. (you need to run the emulator first.)
21. xzjRWgC4Jo8.jpg807x401 34.7 KB
After the application is started click on "Show Notification" button, and application should show
you sample notifications.
You can see that this sample is not adapted for round shape of the watches. You have to avoid
22. this while developing applications for Android Wear.
Sum up
In this tutorial we set up our system for development applications and ran our first Android Wear
application.
In next tutorial I will show you how to connect your watches(or emulator) with your phone(or
tablet). Please don't hesitate to ask any questions and leave feedback. Thank you for reading.
Building Apps for Wearables
These classes teach you how to build notifications in a handheld app that are
automatically synced to wearables as well as how to build apps that run on wearables.
23. Note: For more information about the APIs used in these training classes, see the Wear API
reference documentation.
1.
Adding Wearable Features to Notifications
How to build handheld notifications that are synced to and look great on wearables.
1. Creating a Notification
2. Receiving Voice Input in a Notification
3. Adding Pages to a Notification
4. Stacking Notifications
2.
Creating Wearable Apps
How to build apps that run directly on wearables.
1. Creating and Running a Wearable App
2. Creating Custom Layouts
3. Keeping Your App Visible
4. Adding Voice Capabilities
5. Packaging Wearable Apps
6. Debugging over Bluetooth
3.
Creating Custom UIs
How to create custom user interfaces for wearable apps.
1. Defining Layouts
2. Creating Cards
3. Creating Lists
24. 4. Creating a 2D Picker
5. Showing Confirmations
6. Exiting Full-Screen Activities
4.
Sending and Syncing Data
How to sync data between handhelds and wearables.
1. Accessing the Wearable Data Layer
2. Syncing Data Items
3. Transferring Assets
4. Sending and Receiving Messages
5. Handling Data Layer Events
5.
Creating Watch Faces
How to create watch faces for wearables.
1. Designing Watch Faces
2. Building a Watch Face Service
3. Drawing Watch Faces
4. Showing Information in Watch Faces
5. Creating Interactive Watch Faces
6. Providing Configuration Activities
7. Addressing Common Issues
8. Optimizing Performance and Battery Life
6.
Detecting Location
25. How to detect location data on Android Wear devices.
[TUTORIAL] How to develop Android Wear apps for
Beginners. Part 2 - Connect Android Wear with
handheld device
AndroidWear
androidwear tutorial dev
1
/
4
calmarj
Jan 17
9
In my previous tutorial I told you how to set your development environment for Android Wear, create
and run a project from Google samples, and how to create Android Wear (AVD).
You can read it here:
www.smartwatch.me
[TUTORIAL] How to develop Android Wear apps for Beginners. Part 1 - Setup
Android Wear is a new version of the Android system designed specifically for wearables , which
was announced by Google in march 2014. Currently lots of devices running on Android Wear were
released, including well designed Moto 360 and Gear Live by Samsung.But still, amount of
applications using all the benefits of Android Wear in Google Play is considerably small. In this
tutorial I'm going to show you how to create apps for Android Wear from Scratch. Set up the Android
development en...
You can develop not only Wearable apps with Android Wear SDK, but also you can create apps for
smartphones and tablets (we are going to refer to them as handheld devices) that support output of
data on Android Wear. We are going to create this kind of application in next tutorial.
In this tutorial we are going to learn how to connect your Android Wear emulator with your
handheld device.
Set up the handheld device
26. 1. Download the Android Wear companion app on your handheld device from Google Play.
cJPlJ8Mp5L0.jpg1280x769 83 KB
2. Run the app and allow it access to the location of the device.
3. Enable USB debuging on your device.
On Android 4.0 and newer, you can find in here: Setting > Developer options.
Please notice:
on Android 4.2 and newer, Developer options is hidden by default. You can make it available like
this: go toSettings > About phone and tap Build number 7 times.
27. J_oR-0xbGwc.jpg1280x769 54.2 KB
4. Connect your handheld device to the computer with a USB cable
5. Check that your device is connected. For this you can use Android Debugs Bridge(ADB) - an
important command line tool for Android development.
For Windows:
Run command prompt(cmd command in the run menu). Go to the Android SDK
folder using cdcommand. Then go to platform tools folder. Now use command: adb.exe
devices. That command will list of all plugged Android devices.
For Linux:
Open terminal and run adb command with “device” flag. Iwill show how to do it on my system:
It showed that my Nexus 7 is attached.
Please notice:
If your list is empty, wait till USB driver is installed.
28. If your USB driver is installed and list is still empty, use this instruction,(this can occur if you have
Windows 8):http://stackoverflow.com/questions/21408674/adb-error-device-not-found40
If you want to know more about adb you can check Google
documentation:http://developer.android.com/tools/help/adb.html13
or read very good tutorial from Vogella:
http://www.vogella.com/tutorials/AndroidCommandLine/article.html16
Create AVD
You can read in my previous tutorial how to create Android Watch emulator (link in the beginning of
this post)
Connect handheld device with AVD
1. Forward the AVD's communication port to the connected handheld device. You can do it by
following command with adb:
Please notice: you need to do it each time you connect hadheld device.
2. Run Android Wear app on handheld device, go to Settings and click on "Connect to
emulator". (AVD has to be turned on)
3. Now AVD and handheld device are connected. You can send notifications, change the
appearance of the watch. Go to Settings and choose "Demo cards".
Here you can experiment with different demo cards.The cards you select appear as notifications on
the home screen of the emulator. For example, how much time you need to get to home or the
29. current weather.
Sum up
In this tutorial we connected Android Wear emulator with handheld device and sent sample
information to emulator
In next tutorial I will show you how to create your first app for handheld device, which will sent
custom notifications on watches. Please don't hesitate to ask any questions and leave feedback.
Thank you for reading.
Continue reading to Part 3 - Creating your first app!
www.smartwatch.me
[TUTORIAL] How to develop Android Wear apps for Beginners. Part 3 - Create
your first app "Hello World"
Studying new programming language always begins with "Hello World" program. We are going to do
the same and we will create an application for handheld devices that will send "Hello World"
notification to an Android Wear Device. In my previous tutorials you can read how to set up
development environment, create Android Wear emulator and connect it with your handheld device:
Firstly, we are going to look at the program structure in Android. Android applications usually consist
of the set of A...