Thanks for the response. Here are some extra details:
Can you provide some more information about device you are using and it's Android version?
I am using a HTC m8 with Android version 4.4.4.
What is the exact version of SDK you are using?
I have been testing with 0.10.1.
Can you also provide code where you initialize BeaconManager, construct region object and start monitoring.
My code is derived from the sample app I downloaded from cloud.estimote.com. I have a BeaconNotificationsManager which contains a BeaconManager
package *REMOVED*;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.support.v4.app.NotificationCompat;
import android.util.Log;
import com.estimote.sdk.Beacon;
import com.estimote.sdk.BeaconManager;
import com.estimote.sdk.Region;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
public class BeaconNotificationsManager {
private static final String TAG = "Proximity Test";
public BeaconManager beaconManager;
private List<Region> regionsToMonitor = new ArrayList();
private HashMap<String, String> enterMessages = new HashMap();
private HashMap<String, String> exitMessages = new HashMap();
private Context context;
private int notificationID = 0;
public BeaconNotificationsManager(Context context) {
this.context = context;
beaconManager = new BeaconManager(context);
beaconManager.setBackgroundScanPeriod(5000, 100);
beaconManager.setMonitoringListener(new BeaconManager.MonitoringListener() {
@Override
public void onExitedRegion(Region region) {
System.out.println("estimote - onExitedRegion: " + region.getIdentifier());
String message = exitMessages.get(region.getIdentifier());
System.out.println("estimote - onExitedRegion: " + message);
if (message != null) {
showNotification(message);
}
}
@Override
public void onEnteredRegion(Region region, List<Beacon> list) {
System.out.println("estimote - onEnteredRegion: " + region.getIdentifier());
String message = enterMessages.get(region.getIdentifier());
System.out.println("estimote - onEnteredRegion: " + message);
if (message != null) {
showNotification(message);
}
}
});
}
public void addNotification(BeaconID beaconID, String enterMessage, String exitMessage) {
Region region = beaconID.toBeaconRegion();
enterMessages.put(region.getIdentifier(), enterMessage);
exitMessages.put(region.getIdentifier(), exitMessage);
regionsToMonitor.add(region);
}
public void startMonitoring() {
beaconManager.connect(new BeaconManager.ServiceReadyCallback() {
@Override
public void onServiceReady() {
for (Region region : regionsToMonitor) {
beaconManager.stopMonitoring(region);
beaconManager.startMonitoring(region);
}
}
});
}
private void showNotification(String message) {
Intent resultIntent = new Intent(context, com.bredir.boopsie.cerritos.Boopsie.class);
PendingIntent resultPendingIntent = PendingIntent.getActivity(
context, 0, resultIntent, PendingIntent.FLAG_UPDATE_CURRENT);
NotificationCompat.Builder builder = new NotificationCompat.Builder(context)
.setSmallIcon(android.R.drawable.ic_dialog_info)
.setContentTitle("Region Test")
.setContentText(message)
.setDefaults(NotificationCompat.DEFAULT_ALL)
.setPriority(NotificationCompat.PRIORITY_HIGH)
.setContentIntent(resultPendingIntent);
NotificationManager notificationManager =
(NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.notify(notificationID++, builder.build());
}
}
My Application then contains a BeaconNotificationsManager with the following initialization code
private boolean beaconNotificationsEnabled = false;
public BeaconNotificationsManager beaconNotificationsManager;
public void enableBeaconNotifications() {
if (beaconNotificationsEnabled) { return; }
beaconNotificationsManager = new BeaconNotificationsManager(this);
beaconNotificationsManager.addNotification(
new BeaconID("B9407F30-F5F8-466E-AFF9-25556B57FE6D", REMOVED, REMOVED),
"Hello",
"Goodbye"
);
beaconNotificationsEnabled = true;
beaconNotificationsManager.startMonitoring();
}
enableBeaconNotifications is called in the onCreate method of my main Activity.
Are you using SecureUUID? If so, are you using SecureRegion to monitor it?
No, I am not currently using SecureUUID.
Thanks again for the response.