I am using Android Studio (IntelliJ) IDE for building an android app which uses AltBeacon to detect beacons. I am trying out this sample and trying to understand the basics behind it. I am running the sample of android simulator (ADT 1.1.0 and gradle 2.2.1). When I turn on the TimedBeaconSimulator
, I can see them after clicking on Start Ranging
. There are some things I noticed which are confusing a bit -
a) It always shows Id3:2
and Id3:3
, and never 1 and 4, though all of them are added to beacons list.
b) When the app is closed, it crashes, not sure why.
c) As I understand the MonitoringActivity
is there to detect beacons in background. But it is not happening. Is it not built for detecting simulated beacons (which are part of sample)? I tried adding these lines in AndroidManifest.xml
(reference), but got below error on gradle build -
Error:(35, 41) Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : Attribute service#org.altbeacon.beacon.service.BeaconService@exported value=(true) from AndroidManifest.xml:35:41
is also present at org.altbeacon:android-beacon-library:2.1.4:27:13 value=(false)
Suggestion: add 'tools:replace="android:exported"' to <service> element at AndroidManifest.xml:35:9 to override
Please help with this. I am very new to beacons and trying to grasp these concepts.
Edit
David, To get around the issue of app crashing due to interference with Android L BLE scanning, I have added this check in my code -
public boolean IsBLESupportedOnDevice(Context context) {
if (Build.VERSION.SDK_INT >= 19 && context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_BLUETOOTH_LE))
{
Log.d(TAG, "BLE is supported, so need to disable L scanning");
return true;
}
return false;
}
If it returns true, I am adding below line in the code -
beaconManager.setAndroidLScanningDisabled(true);
Can you verify if the API level and rest of the condition looks good?