ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

New WINDEV Mobile 25 feature!
The content of this page has been updated to version 26.  See documentation 26 now.
Help / Editors / Android
  • Overview
  • Reminder: the target API level ("TargetSdkVersion")
  • Behavior of applications in the background
  • Overview
  • Changes from WINDEV Mobile 25 Update 3
  • List of related functions
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Android 10: Modifying the behavior of applications
Overview
After each new version of Android is deployed, Google requires a higher target API level ("TargetSdkVersion") to publish applications on Google Play. With the release of Android 10, Google now requires API level 29 to allow deployments. This applies from:
  • 3 August 2020 for new applications,
  • 2 November 2020 for application updates.
To generate an application with this API level, it is necessary to use WINDEV Mobile 25 "Update 4".
These are the changes that apply to applications:
  1. On Android 10
    • When the application is in the background, it is no longer possible to open a window. For more details, see Behavior of applications in the background.
    • It is no longer possible to get a unique device identifier with SysIMEI and SysSerialNum. "Device owner" applications are not affected by this restriction.
    • It is no longer possible to manipulate WiFi connection parameters by programming. The following functions trigger a fatal error when used in Android 10 or higher: WiFiActivate (syntax to modify activation only), WiFiAddNetwork, WiFiDeleteNetwork, WiFiConnect and WiFiListNetwork.
      "Device owner" applications are not affected by this restriction.
    • The content of the clipboard can no longer be retrieved if the application is in the background. In this case, Clipboard will return an empty string.
  2. On Android 10 with API level 29:
    • Applications can no longer access files located on the external storage, outside their specific directories (SysDirExternalStorage with sseApp* constants).
      These files can no longer be accessed in read or write mode. Fixed file paths or paths built from SysDirStorageCard or SysDirExternalStorage with ssePublic* constants must therefore no longer be used. This restriction will be permanent from Android 11, API level 30. On Android 10 (API level 29), some of these locations can still be accessed, so they remain usable with WINDEV Mobile. However, it is recommended to make the necessary adaptations to the applications that access them.
    • Android 10 has implemented a new permission for the functions that allow locating the device: ACCESS_BACKGROUND_LOCATION.
      This permission is automatically added when one of the following functions is used in the application to allow its use in the background:
      BeaconDetectBackgroundAllows the application to be notified when the device enters into or exits from an area corresponding to the emission radius of a set of Beacon tags.
      BeaconDetectPreciseUsed to find the Beacon tags nearby the device.
      BTLEListDeviceReturns the list of accessible Bluetooth Low Energy devices.
      BTListDeviceReturns the list of accessible Bluetooth devices.
      geoTrackingEnableEnables the management of location tracking in a WINDEV Mobile application.
      GPSDetectPositionAsks to be notified when the device gets close to a given position.
      GPSFollowMovementAsks to be regularly notified about the current device position.
      GPSGetPositionRetrieves information about the current device position.
      GPSInfoReturns the information about the location provider used by the application for geolocation functions.
      GPSInitParameterInitializes the parameters of geolocation WLanguage functions and finds a location provider.
      GPSLastPositionRetrieves the information about the last known device position.
      GPSStatusRetrieves the activation status of the geolocation provider or asks to be notified when the status changes.
      GPSStopDetectionStops the detection of position that was started by GPSDetectPosition.
      MapFollowMovementDisplays the current device position in a Map control and updates this position during its move.
      MobileNetworkConnectionInfoReturns information regarding the current connection to data on the mobile network.
      WiFiDetectAccessPointStarts detecting the Wi-Fi access points currently accessible from the device.
      When this permission is added to the application, the user can allow the access to the device's location when the application in the background, allow the access only when the application is in use, or deny the access. The user can also change these permissions at any time in the Android settings.
Remark: The following error may appear when publishing an application on the Play Store: "The private key was not properly encrypted or is not a type of key we support". It is necessary to recreate the signature file of the application (this file can be recreated in the application generation wizard)..
Caution: If identifiers are based on the signature file (e.g. Google Map identifier), it is also necessary to regenerate these identifiers with the new key.

Reminder: the target API level ("TargetSdkVersion")

When an Android application is compiled, the generated APK includes a target API level ("TargetSdkVersion") of the Android SDK. With this level of target API, Android determines the features that can be included in the application, and the security rules that must be applied to it.
The target API level ("TargetSdkVersion") assigned to an application can be seen in the APK generation wizard, in the "Configuration" step:
  1. Click "Advanced configuration",
  2. In the "Advanced configuration" window, select "Edit manifest",
  3. Expand the "uses-sdk" node,
  4. "android:targetSdkVersion" shows the target API level.
This API level can also be modified. This means that it is possible to specify target API level 29 in a WINDEV Mobile application generated with a version earlier than Update 4. But in this case the application will not have a framework adapted to the specifics of this API level. This solution should therefore be avoided, since Android will apply security rules different from those for which the application has been tested.
See Google's website for more details.
Behavior of applications in the background

Overview

From Android 10, Google no longer allows an application running in the background to open a window (Activity) https://developer.android.com/guide/components/activities/background-starts. This is a very important change that affects all Android applications, including those generated with WINDEV Mobile. "Device owner" applications are the only exception. In this specific mode, apps can still open a window.
An application that ran properly in all Android versions prior to 10 will therefore have limitations if it is installed on Android 10:
  • when the application is in the background, it can no longer open a window (OpenMobileWindow, Info, Error, Dialog, etc.),
  • a WLanguage function that opens a window can no longer be used (SMSRunApp, etc.),
  • the Android framework of the application will also be blocked and will not be able to open a window from the background. The following functionalities require opening a window from the background:
These limitations apply to all applications generated with WINDEV Mobile 25 "Update 2" and earlier versions.

Changes from WINDEV Mobile 25 Update 3

The Android framework of WINDEV Mobile applications has been modified to take into account this requirement from Google. All necessary adaptations are included from WINDEV Mobile 25 "Update 3" onwards.
From WINDEV Mobile 25 "Update 3", push notifications, position tracking, beacon detection, ... are restored. Additionally, the WLanguage security mechanism has been improved to trigger a fatal error if a function that opens a window is called when the application is in the background (see list of relevant functions).
In order to make sure that an application runs properly on Android 10, you need to:
  • use WINDEV Mobile 25 "Update 3" to generate it,
  • check all processes that can be run from the application in the background : these processes must not open a window. To optimize your code, you can:
    • Use InBackgroundMode to determine whether or not the current process is run in the background.
    • If an application needs to interact with the user while it is in the background, the recommended solution is to display a notification. When the notification is clicked on, the application will be brought back to the foreground and will be allowed to open a window from the procedure called via the ..ActionClick property of the notification (..ActivateApplication must be set to True for the Notification variable).
  • when fine-tuning the application on an Android device, use the Android log to identify the origin of a possible crash during background execution. Since a window cannot be opened from the background, the WLanguage security mechanism cannot transmit any information. Errors are logged in the Android log.

List of related functions

The following functions trigger a fatal error if a call is made from a code run in the background:
AlbumPickerRetrieves a photo, an image or a video stored in the photo album of the mobile device.
AppointmentCreateDisplays the window for appointment creation of native application for managing appointments found on the Android device.
AppointmentDisplayDisplays an appointment in the native application for managing appointments found on the mobile device (Android or iOS).
AppOpenFormOpens:
  • the form of an application on Android (Play Store), iOS (App Store) or Windows (Windows Store) in order for the user to give a mark to it and/or to comment it.
  • the form for configuring the In-App purchases of an application.
AuthIdentifyPerforms an authentication using the OAuth 2.0 protocol on any webservice.
BCCaptureDecodes the information stored in a bar code by using the device camera (Android, iPhone, iPad).
BTChangeVisibilityChanges the visibility of a Bluetooth radio.
CheckUserIdentityAllows you to check the real identity of the current user via biometrics check.
ConfirmDisplays a message in a standard dialog box that proposes "Yes", "No", "Cancel" and returns the user's choice.
New in version 25
ConfirmAsynchronous
Displays a non-blocking message in a standard dialog box with the answers "Yes", "No", "Cancel" and calls a WLanguage procedure with the user's response.
ContactCreateDisplays the window for contact creation of the native application for contact management found on the device (Android, iPhone or iPad, Universal Windows).
ContactDisplayOpens the form of a contact in the native application for contact management of the device (Android, iPhone or iPad, Universal Windows).
ContactEditOpens the form of a current contact in edit mode in the native application for contact management found on the device (Android, iPhone, iPad, Universal Windows).
ContactSelectDisplays the list of contacts found on the device (Android, iPhone or iPad, Universal Windows).
DatePickerDisplays the system date picker.
DialogDisplays a message box and returns the value of the button clicked by the user.
New in version 25
DialogAsynchronous
Displays a non-blocking message box and calls a WLanguage procedure with the value of the button clicked by the user.
EmailOpenMailOpens the default messaging software:
  • of Web user on the browser computer.
  • of the user on the current Windows computer.
  • on the phone.
EmailRunAppStarts the native application for sending emails found on the current computer:
  • Computer running Windows,
  • Mobile device (Android, iPhone, iPad).
ErrorDisplays a custom error message in a system error window.
New in version 25
ErrorAsynchronous
Displays a custom error message in a non-blocking system error window.
ErrorBuildDisplays a custom error message in a system error window.
ExeRunStarts the execution of a program (an executable for example) from the current application.
FBStartSessionUsed to authenticate and log in to Faceboook.
geoRunAppStarts the native mapping application of the device to display:
  • a specific geographical location,
  • an itinerary between two locations.
GglPrintDocumentPrints a document (text or PDF file, images, Word or Excel document, ...) by using the Cloud Print service of Google.
gpwAuthLoginAllows you to connect to the User Groupware using authentication with an account such as Facebook, Google, Microsoft, etc.
inAppPurchaseProductSends a request for purchasing an "In-App" product associated with the application.
InfoDisplays a custom message in a system information window.
New in version 25
InfoAsynchronous
Displays a non-blocking custom message in a system information window.
InfoBuildDisplays a custom message in a system information window.
InputDisplays a message allowing the user to type an information.
New in version 25
KioskDisable
Disables kiosk mode for the current application.
New in version 25
KioskEnable
Switches the current Android application to kiosk mode.
NFCReadTagStarts reading a NFC tag or enables the detection of NFC tags for the current window.
NFCSendTagSends a NFC tag to another device.
NFCWriteTagStarts writing data onto a NFC tag.
OKCancelDisplays a message in a standard dialog box that proposes "OK" and "Cancel" and returns the user's choice.
New in version 25
OKCancelAsynchronous
Displays a message in a standard non-blocking dialog box with the answers "OK" and "Cancel" and calls a WLanguage procedure with the user's response.
OpenMobileWindowOpens a window in a mobile application.
ShellExecuteOpens a document in its associated application.
SMSRunAppStarts the native application for sending SMSs found on the device (Android or iPhone/iPad).
SpeechRecognitionTriggerTriggers the service for speech recognition on the device.
SpeechSynthesisInitializeInitializes the parameters of speech synthesis for the current application.
SpeechSynthesisReadFileReads the content of the specified file by using the engine for speech synthesis found on the device.
SpeechSynthesisReadTextReads the specified text using the device's text-to-speech engine.
StartShareOpens a popup allowing you to select the application that will be used to share a resource (text or document).
tapiDialerCallOpens the default telephony application (dialer) found on the phone and dials the specified number.
tapiDialerDisplayOpens the default telephony application (dialer) and displays the specified number. No call is made.
TimePickerDisplays the time picker of system.
URISelectOpens a system window to select a resource coming:
  • from the device file system,
  • from the Cloud (Google Drive, Microsoft OneDrive, etc.)
  • or from one of the content managers installed on the device.
VideoStartAppStarts the device's native camera application to record a video or to take a photo.
WarningDisplays a custom message in a system warning window.
New in version 25
WarningAsynchronous
Displays a custom message in a non-blocking system warning window.
YesNoDisplays a message in a standard dialog box that proposes "Yes" and "No" and returns the user's choice.
New in version 25
YesNoAsynchronous
Displays a message in a standard non-blocking dialog box with the answers "Yes" and "No" and calls a WLanguage procedure with the user's response.
Minimum version required
  • Version 25
Comments
Click [Add] to post a comment

Last update: 10/09/2020

Send a report | Local help