- Special case: Google Glass
- Implementing a dialog with a connected object
Connected objects: Android Wear
Android Wear is the version of the Android operating system dedicated to the connected objects: watch, bands, rings, ...
This version is suitable for smaller devices (screen size, battery power) devoid of keyboard.
Displaying a message and Proposing a response
From version 20, the WINDEV Mobile applications can display messages, images, questions and they can propose responses on the Android Wear devices.
This dialog is performed via rich notifications.
- the end user can receive an alert on his watch and he can choose the action to perform by clicking the choices proposed on his watch.
- an end user can receive a message on his watch and he can dictate (verbally!) his response to the watch. The phone will directly receive the answer in text form.
- The management of connected objects is available from Android 4.4.
- If several objects are connected to the same phone, the notifications will be displayed on all the connected objects (except for Google Glass).
Special case: Google Glass
The Google Glass are a connected object. You have the ability to send notifications with actions via the phone to the glasses.
Remark: If the phone includes a connection to a watch AND to Google Glass, the notification cannot be sent to the two of them. The glasses have priority.
Implementing a dialog with a connected object
To use an Android application on a connected object (a watch in most cases), the object must be connected to the Android phone. The object becomes a deported screen for the application that is run on the phone.
Therefore, a notification sent to the phone is also displayed on the watch. When the notification is read on the phone, it disappears from the connected object (and conversely, a notification read on the connected object disappears from the phone).
If the notification triggers an action, the application will be started on the phone (if necessary) and the procedure associated with the action will be run.
If the notification expects a response:
- with the system of preset responses, all you have to do is select the response on the connected object.
- with the system of free responses, the user will dictate the response to the connected object and the response will be typed on the phone.
To implement a dialog with a connected object, all you have to do is use the notification system (local notifications or Push notifications).
To implement a local notification:
- Create a Notification variable.
- Define the different properties of notification.
- Use NotifAdd to add the notification.
Example: Procedure used to send a notification regarding the health of an animal:
PROCEDURE AddNotif(rTemp is real, rWeight is real)
// Define the notification
MyNotif is Notification
MyNotif.Title = "My animal"
rWeight = Round(rWeight)
MyNotif.Message = StringBuild("My animal weighs %1kg (- 12 kg) " + ...
" and his temperature is equal to %2°c", rWeight, rTemp)
MyNotif.DisplayLED = True
MyNotif.ColorLED = RGB(255, 255, 255)
MyNotif.Sound = notifDefaultSound
MyNotif.Vibration = True
MyNotif.ActivateApplication = True
// Expanded notification (Android 4.1)
MyNotif.Format.Type = notifImageFormat
MyNotif.Format.Content = "animal.jpg"
MyNotif.AdditionalAction.ActionLabel = "Treat the animal"
MyNotif.AdditionalAction.Icon = "icon_notif.png"
MyNotif.AdditionalAction.ActionClick = CallbackNotif
MyNotif.AdditionalAction.QuestionLabel = "What do you want to give him?"
MyNotif.AdditionalAction.ResponseChoice = "Syrup" + CR + "Tablet" + CR + "Injection"
// Adds the notification