AYUDA EN LÍNEA
 WINDEVWEBDEV Y WINDEV MOBILE

¡Nueva funcionalidad de WINDEV Mobile 25!
El contenido de esta página se actualizaó a la versión 26.  Consulte la documentación 26 .
Ayuda / 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 AppJavaReportes y ConsultasCódigo de Usuario (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Código Navegador
WINDEV Mobile
AndroidWidget Android iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Otros
Procedimientos almacenados
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 3" (250089E) with the update reference 118 661. To get this update:
  • go to Useful resources on windev.com,
  • select "Upgrades available for WINDEV, WEBDEV or WINDEV Mobile",
  • use "Ask for an upgrade" for reference 118 661 published on 8/20/2020.
Remark: this update will be automatically included in future WINDEV Mobile updates.
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 update 118 661. 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:
      BeaconDetectBackgroundPermite notificar a la aplicación cuando el dispositivo entra o sale de una zona correspondiente al radio de emisión de un conjunto de etiquetas de baliza.
      BeaconDetectPreciseSe utiliza para encontrar las etiquetas de la baliza cerca del dispositivo.
      BTLEListDeviceDevuelve la List de los dispositivos accesibles de Bluetooth de baja energía.
      BTListDeviceDevuelve la lista de dispositivos Bluetooth accesibles.
      geoTrackingEnablePermite la gestión del seguimiento de localización en una aplicación WINDEV Mobile.
      GPSDetectPositionPide ser notificado cuando el dispositivo se acerca a una posición determinada.
      GPSFollowMovementPide que se le notifique regularmente sobre la posición actual del dispositivo.
      GPSGetPositionRecupera información sobre la posición actual del dispositivo.
      GPSInfoDevuelve la información sobre el proveedor de ubicación utilizado por la aplicación para las funciones de geolocalización.
      GPSInitParameterInicializa los parámetros de las funciones de geolocalización de WLanguage y encuentra un proveedor de localización.
      GPSLastPositionRecupera la información sobre la última posición conocida del dispositivo.
      GPSStatusRecupera el estado de activación del proveedor de geolocalización o pide que se le notifique cuando el estado cambia.
      GPSStopDetectionDetiene la detección de la posición que se inició con GPSDetectPosition..
      MapFollowMovementMuestra la posición actual del dispositivo en un mapa control y actualiza esta posición durante su movimiento.
      MobileNetworkConnectionInfoDevuelve información sobre la conexión actual a los datos de la red móvil.
      WiFiDetectAccessPointInicia la detección de los puntos de acceso Wi-Fi actualmente accesibles desde el dispositivo.
      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. go to "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 without update 118 661. 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:
Versión mínima requerida
  • Versión 25
Comentarios
Haga clic en [Agregar] para publicar un comentario

Última modificación: 28/08/2020

Señalar un error o enviar una sugerencia | Ayuda local