ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Mobile specific functions / Phone functions
  • Overview
  • Special case: Google Glass
  • Implementing a dialog with a connected object
  • Principle
  • Implementation
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Overview
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
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.
For example:
  • 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.
Remarks:
  • 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

Principle

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.

Implementation

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:
  1. Create a Notification variable.
  2. Define the different properties of the notification.
  3. 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"

// Actions
MyNotif.AdditionalAction[1].ActionLabel = "Treat the animal"
MyNotif.AdditionalAction[1].Icon = "icon_notif.png"
MyNotif.AdditionalAction[1].ActionClick = CallbackNotif
MyNotif.AdditionalAction[1].QuestionLabel = "What do you want to give him?"
MyNotif.AdditionalAction[1].ResponseChoice = "Syrup" + CR + "Tablet" + CR + "Injection"

// Adds the notification
NotifAdd(MyNotif)
Minimum version required
  • Version 20
Comments
Click [Add] to post a comment

Last update: 02/27/2024

Send a report | Local help