I am using Android beacon library and have implemented RegionbootStrap
following way:
In Application class
public void onCreate() {
super.onCreate();
Region region = new Region(getPackageName(), null, null, null);
mRegionBootstrap = new RegionBootstrap(this, region);
new BackgroundPowerSaver(this);
}
@Override
public void didEnterRegion(Region arg0) {
mRegionBootstrap.disable();
Intent intent = new Intent(this, MainActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
}
In manifest
<activity
android:name=".activity.MainActivity"
android:configChanges="keyboardHidden|orientation|keyboard"
android:launchMode="singleInstance"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
</activity>
When I start the application, it successfully scans iBeacons in foreground and background using RangeNotifier
. I also use my own periods for scanning and delay for scanning. But I don't know how the get test the RegionbootStrap
. I have tried to launch the application, then force close it, reboot device and go near iBeacon. Also tried to plug/unplug USB cable near iBeacon giving no callbacks either.
Thanks.