My Android app does not detect beacons?
Beacon detection troubleshooting is divided in three steps: SDK configuration, device configuration and MOCA Console configuration.
1. MOCA SDK requires the following configuration checks in the MOCA.properties file:
- Flag proximityService is present and set to true. E.g. proximityService=true
- Flag geoTrackingService is present and set to true. E.g. geoTrackingService=true
- Flag backgroundLocation is present and set to true. E.g. backgroundLocation=true
- Flag mocaDriver is present and set to true. E.g. mocaDriver=true
- Flag beaconProfile is present and set to any value in [LowLatency, Balanced, BatterySaver, Custom]. E.g. beaconProfile=Balanced
- If the profile is custom, you require the following flags and values:
- foregroundTimeBetweenScans=3300
- foregroundScanDuration=3300
- backgroundTimeBetweenScans=60000
- backgroundScanDuration=5001
The MOCA SDK requires that you request for the necessary permissions. In this case Beacons require the Location Permission. Make sure your app requests this permission before attempting to interface with Beacons. Please note that Android 10 has a permission called “while in use” and this causes the SDK to only see beacons if the App is in foreground. Below Android 10 the Location Permission will allow for beacon scanning when the app is not in foreground.
You can set and view the state of each service programmatically using the following methods:
- MOCA.setProximityEnabled(true);
- MOCA.setGeoTrackingService(true);
2. The second step is to troubleshoot the device used to detect the beacons:
- Double check if Bluetooth is active.
- Ensure the application hasn’t been put to sleep by the manufacturers power saving app. A very informative link here about this popular issue.
- Check that your native Android Battery Saver is not turned on.
- Make sure the notifications for your app are active and the channel has not been muted.
- Use an app that detects iBeacon BLE devices in order to evaluate if the beacon per se needs configuration (advertising interval, signal strength, dynamic UUID).
3. The third step is to make sure the beacon is registered in the MOCA Console and the UUID, major and minor are identical to the ones that the beacon is currently broadcasting. Once the beacon has been set up accordingly, proceed to generate an Experience that uses such beacon as a trigger. A step by step guide to test proximity after SDK integration can be found here.
Related Articles
Android 10 and MOCA SDK
MOCA Android SDK has been tested in the Android 10 OTA. Find the notes for this version below: Android 10 introduces a new permission model where the user can choose between “When in Use” or “Always” location permission. The SDK works correctly with ...
Android Permissions Detailed for MOCA SDK
The MOCA SDK requests a variety of permissions, some of them being optional. Here is a breakdown of each permission and their effect on the SDK: Permission Explanation android.permission.INTERNET Allows MOCA SDK to open network sockets so it has ...
Recommendation for Deep links in Android
Observation: Deep linking can bring the issue of "duelling activities". The concerning condition is deep-linking into an app that uses a multiple activity stack, where the root activity has no content (e.g. using launch activity to enforce an ...
Android Studio Instant Run and MOCA SDK
It is recommended to turn off Instant Run in Android Studio. Instant Run uses portions of the SDK that might not be necessary for your integration and give you false error and warning messages. Example stack trace when using Instant Run: I/art: ...
MOCA SDK Beacon detection engine latency
The MOCA SDK detection engine differentiates between foreground and background, and works differently in iOS and Android. For Android, in the foreground it scans more aggressively and, using the Balanced profile, detect beacons within 5 seconds ...