GNSBeaconStrategy Class
Stay organized with collections
Save and categorize content based on your preferences.
The strategy to use to scan for beacons.
Inherits NSObject.
|
(instancetype) | + strategy |
| Returns the default strategy, which uses the default values for all properties. More...
|
|
(instancetype) | + strategyWithParamsBlock: |
| Returns a custom strategy. You can set any of the optional properties in paramsBlock . More...
|
|
+ (instancetype) strategy |
|
|
|
Returns the default strategy, which uses the default values for all properties.
Returns a custom strategy. You can set any of the optional properties in paramsBlock
.
Scan also for nearby iBeacons.
The default is YES
. Scanning for iBeacons triggers a location permission dialog from iOS, so you should set this to NO
if you don't want to scan for iBeacons.
- (BOOL) allowInBackground |
|
readnonatomicassign |
Try to scan for beacons when the app is in the background.
The default is NO
.
- (BOOL) lowPowerPreferred |
|
readnonatomicassign |
Low power mode is available when scanning for Eddystone beacons only; it is ignored when iBeacons are included.
Turn off low power mode if you prefer lower latency scanning, at a higher battery cost.
The default is YES
.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-08-12 UTC.
[null,null,["Last updated 2025-08-12 UTC."],[[["\u003cp\u003eThe \u003ccode\u003eGNSBeaconStrategy\u003c/code\u003e class defines the strategy used to scan for nearby beacons, including iBeacons and Eddystone beacons.\u003c/p\u003e\n"],["\u003cp\u003eIt provides methods for creating default and custom strategies, allowing control over scan behavior like background scanning and power usage.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eincludeIBeacons\u003c/code\u003e property determines whether to scan for iBeacons alongside Eddystone beacons, requiring location permissions if enabled.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eallowInBackground\u003c/code\u003e enables scanning while the app is in the background, while \u003ccode\u003elowPowerPreferred\u003c/code\u003e prioritizes lower battery consumption when scanning for Eddystone beacons only.\u003c/p\u003e\n"]]],[],null,["# GNSBeaconStrategy Class\n\n[Class Methods](#pub-static-methods) \\| [Properties](#properties) \nGNSBeaconStrategy Class Reference \n\nOverview\n--------\n\nThe strategy to use to scan for beacons.\n\nInherits NSObject.\n\n|----------------|---------------------------------------------------------------------------------------------------------------------------------------|\n| Class Method Summary -------------------- ||\n| (instancetype) | + [strategy](/nearby/messages/ios/reference/interface_g_n_s_beacon_strategy#adb20ee9c949a83bb6b40f298afc8d18c) |\n| | Returns the default strategy, which uses the default values for all properties. [More...](#adb20ee9c949a83bb6b40f298afc8d18c) |\n| ||\n| (instancetype) | + [strategyWithParamsBlock:](/nearby/messages/ios/reference/interface_g_n_s_beacon_strategy#ae4369cbfc0033043904d608a941ffab9) |\n| | Returns a custom strategy. You can set any of the optional properties in `paramsBlock`. [More...](#ae4369cbfc0033043904d608a941ffab9) |\n| ||\n\n|------|---------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Property Summary ---------------- ||\n| BOOL | [includeIBeacons](/nearby/messages/ios/reference/interface_g_n_s_beacon_strategy#a760bff5c7b04f6aca45f5eb1b00f64d6) |\n| | Scan also for nearby iBeacons. [More...](#a760bff5c7b04f6aca45f5eb1b00f64d6) |\n| ||\n| BOOL | [allowInBackground](/nearby/messages/ios/reference/interface_g_n_s_beacon_strategy#a78563e40e80e958da3381600240063d7) |\n| | Try to scan for beacons when the app is in the background. [More...](#a78563e40e80e958da3381600240063d7) |\n| ||\n| BOOL | [lowPowerPreferred](/nearby/messages/ios/reference/interface_g_n_s_beacon_strategy#a24d256ff2f7cf627b539534bb0a1241d) |\n| | Low power mode is available when scanning for Eddystone beacons only; it is ignored when iBeacons are included. [More...](#a24d256ff2f7cf627b539534bb0a1241d) |\n| ||\n\nMethod Detail\n-------------\n\n|---------------------------|---|---|---|\n| + (instancetype) strategy | | | |\n\nReturns the default strategy, which uses the default values for all properties. \n\n|-------------------------------------------|---|-----------------------------------------------------------------------------------------------------------------|---------------|---|\n| + (instancetype) strategyWithParamsBlock: | | (void(\\^)([GNSBeaconStrategyParams](/nearby/messages/ios/reference/interface_g_n_s_beacon_strategy_params) \\*)) | *paramsBlock* | |\n\nReturns a custom strategy. You can set any of the optional properties in `paramsBlock`.\n\nProperty Detail\n---------------\n\n|-----------------------------------------------------------|---------------------|\n| |--------------------------| | - (BOOL) includeIBeacons | | readnonatomicassign |\n\nScan also for nearby iBeacons.\n\nThe default is `YES`. Scanning for iBeacons triggers a location permission dialog from iOS, so you should set this to `NO` if you don't want to scan for iBeacons. \n\n|---------------------------------------------------------------|---------------------|\n| |----------------------------| | - (BOOL) allowInBackground | | readnonatomicassign |\n\nTry to scan for beacons when the app is in the background.\n\nThe default is `NO`. \n\n|---------------------------------------------------------------|---------------------|\n| |----------------------------| | - (BOOL) lowPowerPreferred | | readnonatomicassign |\n\nLow power mode is available when scanning for Eddystone beacons only; it is ignored when iBeacons are included.\n\nTurn off low power mode if you prefer lower latency scanning, at a higher battery cost.\n\nThe default is `YES`."]]