Is it possible to call webservice inside the monitoring and ranging block

Is it possible to call webservice inside the monitoring and ranging block.I tried but even though the webservice creating some result it is showing that as null result.Whats the problem,is it possible to call another back ground service along with the april beacon service…

It’s possible. You have 10 seconds for the calling.

Can please tell how to set the monitoring listener period and ranging period.Know it ranging for every 2 seconds and please tell me how to increase this time and please clear my doubt when will monitoring listener will call.

Please explain me what are these 4 parameters functionality:

beaconManager.setMonitoringExpirationMill(10L);

	beaconManager.setRangingExpirationMill(10L);

	beaconManager.setForegroundScanPeriod(5000,3000);

	beaconManager.setBackgroundScanPeriod(5000,3000);

Please reply me as soon as possible.

Thanking you.

I am using 1.6.0 sdk

I tried calling webservice inside the monitoring listener but it is not calling and I also tried calling inside ranging listener but it is calling for every 2 seconds.please tell me how to call webservice inside the monitoring listener or how to increase the rangeinglistener time rather than that two seconds…

beaconManager.setMonitoringExpirationMill(10L);

beaconManager.setRangingExpirationMill(10L);

beaconManager.setForegroundScanPeriod(5000,3000);

beaconManager.setBackgroundScanPeriod(5000,3000);

Please reply me as soon as possible.

Thanking you.

beaconManager.setMonitoringExpirationMill(10L);
If can’t find the beacon in 10 second, onExitedRegion will be callback

beaconManager.setRangingExpirationMill(10L);
If can’t find the beacon in 10 second,the callback result of onBeaconsDiscovered(Region region,List beacon) beacons) will remove the beacon from beacons

beaconManager.setForegroundScanPeriod(5000,3000);
It will callback onBeaconsDiscovered 5 second then stop ranging 3 second, onBeaconsDiscovered will callback every 8 second

beaconManager.setBackgroundScanPeriod(5000,3000);
The same as setForegroundScanPeriod

can i get the code of you call webservice inside the monitoring listener with the code how you start monitoring

									beaconManager.setMonitoringListener(new MonitoringListener() {
										
							
										@Override
										public void onExitedRegion(Region arg0) {
							
											Toast.makeText(MainActivity.this, "you are out", 1000).show();
											
										}
							
										@Override
										public void onEnteredRegion(Region arg0, List<Beacon> arg1) {
											
											
											int signal = 0;
											String uname = null;
											String regid = null;
											for (int k = 0; k < arg1.size(); k++) {
												 signal = arg1.get(k).getRssi();
												beaconid = arg1.get(k).getMacAddress();
												
												Log.v("beacon id is", "beacon id is"+beaconid);
												
												
												
												if (signal >= -50) {
												//	Toast.makeText(MainActivity.this,"nearest beacon" + signal, 1000).show();
													 uname=arg1.get(k).getProximityUUID();
													 int regid1=arg1.get(k).getMinor();
													// beaconid = arg1.get(k).getMacAddress();
													 regid = String.valueOf(regid1);
												}
											}
																									
											Calendar calendar = Calendar.getInstance();
											Date today = calendar.getTime();
							
											calendar.add(Calendar.DAY_OF_YEAR, 1);
											Date tomorrow = calendar.getTime();
							
											SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy");
							
											String todayAsString = dateFormat.format(today);
											String tomorrowAsString = dateFormat.format(tomorrow);
																			
											TelephonyManager TelephonyMgr = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE); 
											String
											macid = TelephonyMgr.getDeviceId();
											
											 new ActivityNotification(currentObj,macid,todayAsString,tomorrowAsString,beaconid).execute();------this is webservice
											
											Toast.makeText(MainActivity.this, "you are inn region", 1000).show();
															}
							
									});

this is not calling even once

beaconManager.setRangingListener(new RangingListener()
{
@Override
public void onBeaconsDiscovered(Region region,final List beacons) {

			int signal = 0;
			String uname = null;
			String regid = null;
			for (int k = 0; k < beacons.size(); k++) {
				 signal = beacons.get(k).getRssi();
				beaconid = beacons.get(k).getMacAddress();
				Toast.makeText(MainActivity.this,"nearest beacon" + beaconid, 1000).show();
				if (signal >= -50) {
				//	Toast.makeText(MainActivity.this,"nearest beacon" + signal, 1000).show();
					 uname=beacons.get(k).getProximityUUID();
					 int regid1=beacons.get(k).getMinor();
					 regid = String.valueOf(regid1);
				}
			}
							Calendar calendar = Calendar.getInstance();
			Date today = calendar.getTime();

			calendar.add(Calendar.DAY_OF_YEAR, 1);
			Date tomorrow = calendar.getTime();

			SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");

			String todayAsString = dateFormat.format(today);
			String tomorrowAsString = dateFormat.format(tomorrow);

			TelephonyManager TelephonyMgr = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE); 
			String
			macid = TelephonyMgr.getDeviceId();
			
			 new ActivityNotification(currentObj,macid,todayAsString,tomorrowAsString,beaconid).execute();---this is webservice
		
			Toast.makeText(MainActivity.this, "you are inn ranging", 1000).show();
			
			myBeacons.clear();
			myBeacons.addAll(beacons);

		}
	});

this is calling for every 2 seconds.please tell me how to increase this 2 seconds time

beaconManager.setForegroundScanPeriod(5000,3000);
It will callback onBeaconsDiscovered 5 second then stop ranging 3 second, onBeaconsDiscovered will callback every 8 second

This is not stop ranging, for every 5 seconds.For every two seconds it is generating toast inside the onDiscovered block.Please find my code and let me know if any modifications on it…

Please reply me…

Try to have a log out under onBeaconsDiscovered to see the between time

Have start monitoring with the method of beaconManager.startMonitoring(youRegion);

try {
beaconManager.startMonitoring(ALL_BEACONS_REGION);
new ActivityNotification(currentObj,macid,todayAsString,tomorrowAsString,beaconid).execute();

	} catch (RemoteException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}

Hell I tried this also but it is calling only once it is not calling for every 10 seconds

And also please tell me how to customize the ranging time and monitoring time I mean How to keep our own time for both of it…

Thanking you HELL…

Monitoring
If you in the region it will callback onEnteredRegion but it can’t callback onEnteredRegion twice until you exit the region

Thank you.Hell,Is there any chance to put our own ranging time rather than that 8 seconds.

you can set you time by beaconManager.setForegroundScanPeriod

Hi hell,
How to measure the amount of time in a particular beacon region.I mean how to run timer in side the ranging and the monitoring.Please reply me.

Thanking you

If you use monitoring to measuer the beacon,you can use monitoring.startMonitoring(new Region(“apr”,beacon.uuid,beacon.major,beacon.minor));
and in onEnteredRegion record the begain time, in onExitedRegion record the end time.