AYUDA EN LÍNEA
 WINDEVWEBDEV Y WINDEV MOBILE

Este contenido se ha traducido automáticamente.  Haga clic aquí  para ver la versión en inglés.
Ayuda / WLanguage / Funciones WLanguage / Comunicación / Funciones Beacon
  • Versión necesaria
  • Bluetooth Low Energy
  • Required permissions
WINDEV
WindowsLinuxJavaReportes y ConsultasCódigo de Usuario (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Código Navegador
WINDEV Mobile
AndroidWidget Android iPhone/iPadIOS WidgetApple WatchMac Catalyst
Otros
Procedimientos almacenados
Used to find the Beacons near the device.
Ejemplo
// In a museum, we want to display on the visitor device the information
// regarding the masterpiece he is looking at. Associate to each Beacon
// the same UUID corresponding to the museum as well as Major and Minor numbers
// allowing each Beacon to be uniquely identified.
// A Beacon is placed next to each work of art in the museum.
// The application must call the BeaconDetectPrecise function with a
// BeaconGroup variable corresponding to the museum tags.
// The callback procedure passed as parameter to the function will be called whenever
// a new list of Beacons is detected. Then, all you have to do is find
// the nearest Beacon to identify the work the visitor is looking at and to display
// the corresponding information in the application.
 
// Museum UUID
sUUID is string = "f4231ab6-5ef2-6c99-4229-af6c72e0446e"
// Create a beaconGroup variable corresponding to the museum tags
groupMuseum is beaconGroup
groupMuseum.UUID = sUUID
// Start the detection
BeaconDetectPrecise(groupMuseum, ProcDetection)
INTERNAL PROCEDURE ProcDetection(arrInfo is array of beaconDetectionInfo)
nMinDistance is int
NearestBeacon is beaconDetectionInfo
FOR EACH Information OF arrInfo
IF nMinDistance = 0 _OR_ Information.Distance < nMinDistance
NearestBeacon = Information
END
END
// Display information about the masterpiece associated with the tag
DisplayMasterpieceInfo(NearestBeacon.Major, NearestBeacon.Minor)
END
Sintaxis
<Result> = BeaconDetectPrecise(<Group of Beacons> , <WLanguage procedure>)
<Result>: Boolean
  • True if the detection was started,
  • False otherwise. To get more details on the error, use ErrorInfo.
<Group of Beacons>: beaconGroup variable
Name the of beaconGroup variable that describes the searched group of Beacons.
<WLanguage procedure>: Procedure name
Name of the WLanguage procedure ("callback") called when a new list of Beacons is detected.
This procedure has the following format:
PROCEDURE <Procedure Name>(<Array of Detection Info>)
where <Array of detection info> is a beaconDetectionInfo variable that describes the information about the detected Beacons (identifiers, Major/Minor numbers, distance, etc.)
Observaciones
  • This function thoroughly studies Bluetooth emissions around the device to detect Beacons and to estimate how far they are. This analysis is energy-intensive: we therefore recommend calling this function only if at least one tag in the group is nearby.
    To do so, you can call BeaconDetectBackground then BeaconDetectPrecise from the callback procedure run when the application detected the entry in the Beacon transmission range.
    Furthermore, we advise you to stop the precise detection as soon as possible. The BeaconStopPreciseDetection function is used to stop detection in progress: for example, it can be called in the WLanguage procedure executed when the application has detected the exit of the group's tags from the emission zone.
  • The precise detection of Beacons is performed only when the application is in the foreground. When the application goes into background, the detection is automatically suspended and it will resume as soon as the application goes back into foreground. The detection is permanently stopped when the application is stopped. To perform a detection in background, use BeaconDetectBackground.
  • iPhone/iPadIOS WidgetMac Catalyst When generating the application, you can allow BeaconDetectPrecise to be called when the application is in the background (option "Allow calling GPSFollowMovement and BeaconDetectPrecise when the application is in the background" in the "Configuration" step of the wizard).. In this case, the precise detection can continue when the application is in background or when the device is in stand-by mode. For more details, see Generating an iOS application.
  • Several precise detections cannot be started at the same time. If BeaconDetectPrecise is called while a detection is already in progress, the current detection will be stopped and a new detection will be started.

Versión necesaria

AndroidWidget Android Las funciones de baliza solo están disponibles en Android 4.3 o posterior (nivel de API 18).
Si se utiliza la función con una versión anterior del sistema, se produce un error fatal.
Para determinar la versión de Android en la que se está ejecutando la aplicación, utilice la función SysAndroidVersion.
iPhone/iPadIOS Widget Las funciones de baliza solo están disponibles en iOS11 o posterior.
AndroidWidget Android

Bluetooth Low Energy

The device must support the Bluetooth Low Energy technology (Bluetooth LE).
AndroidWidget Android

Required permissions

This function changes the permissions required by the application.
Permission required: ACCESS_COARSE_LOCATION: Allows the application to obtain the approximate position of the device.
Android 11 specific case: This function requires the ACCESS_BACKGROUND_LOCATION permission to access the device's location.
This permission allows using the function when the application is in the background.
If the application needs to use background location:
  • Manually add the "ACCESS_BACKGROUND_LOCATION" permission in the Android application generation wizard.
  • Explicitly request background location permission with PermissionRequest. For example:
    PermissionRequest(permBackgroundLocation, Callback)
    INTERNAL PROCEDURE Callback(p is Permission)
    	IF p.Granted THEN
    		// Functions that require background location access can be used
    	END
    END
A window allows users to:
  • allow access to the device location while the application is in the background,
  • allow access to the location only while the application is in use,
  • deny access to the location. The user can also change these permissions at any time in the Android settings.

Remarks:
  • Follow Google's guidelines for applications that require background location access. For more details, see https://support.google.com/googleplay/android-developer/answer/9799150. If these conditions are not met (especially user information requirements), applications may not be accepted for publication on Google Play.
  • The background location permission should only be requested if the location permission has been granted. Otherwise, PermissionRequest will fail.
  • If the option chosen by the user for the background location access request is more restrictive than the option chosen for the location access request, the application will be automatically restarted.
  • On devices running Android 10 or earlier, if location permission has been granted to the application, the background location permission will be granted without displaying a window.
Componente: wd300android.aar
Versión mínima requerida
  • Versión 23
Comentarios
Haga clic en [Agregar] para publicar un comentario

Última modificación: 25/03/2025

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