Wednesday 15 February 2012

android - Altbeacon Launching in the Background detection time issue -



android - Altbeacon Launching in the Background detection time issue -

i using altbeacon lib detecting ibeacons. if observe ibeacons activity starting service detecting ibeacons fine.

now want start same operation in background(sticky service). followed this document. detecting ibeacons problem time. taking long detect. kept period observe below.

public class ibeaconpocsuper extends application implements bootstrapnotifier { private regionbootstrap regionbootstrap; @override public void oncreate() { super.oncreate(); init(); } private void init() { beaconmanager beaconmanager = beaconmanager.getinstanceforapplication(this); beaconmanager.setbackgroundscanperiod(1100l); beaconmanager.setbackgroundbetweenscanperiod(1100l); part region = new region("com.exe", null, null, null); regionbootstrap = new regionbootstrap(this, region); } @override public void onconfigurationchanged(configuration newconfig) { super.onconfigurationchanged(newconfig); } @override public void diddeterminestateforregion(int arg0, part arg1) { // todo auto-generated method stub } @override public void didenterregion(region arg0) { shownotification() ; } @override public void didexitregion(region arg0) { // todo auto-generated method stub } private void shownotification() { notificationcompat.builder mbuilder = new notificationcompat.builder(this).setsmallicon(r.drawable.ic_launcher).setcontenttitle("my notification") .setcontenttext("contentttttttt").setautocancel(true); intent intent = new intent(this, ibeaconnotificationactivity.class); intent.setflags(intent.flag_activity_new_task | intent.flag_activity_single_top); pendingintent resultpendingintent = pendingintent.getactivity(getapplicationcontext(), 0, intent, pendingintent.flag_cancel_current); mbuilder.setcontentintent(resultpendingintent); notificationmanager mnotificationmanager = (notificationmanager) getsystemservice(context.notification_service); mnotificationmanager.notify(1, mbuilder.build()); }

}

android ibeacon-android altbeacon

No comments:

Post a Comment