Ibeacon enter event with login activity

down vote
I am working with iBeacon and developing android app I almost finished the app my Beacon detects and generates enter an exit notifications events so far,

I followed this tutorial on estimote website to generate enter and exit notifications. https://developer.estimote.com/android/tutorial/part-1-setting-up/

but I would like my app only allow user to login if he in range of the beacon.

I’ve been searching for two days and since this is my first time working with beacons I could not figure out how to link the beacon to the loginActivity. Java there is no much useful resources unfortunately.

public class MyBeacon extends Application {

private BeaconManager beaconManager;

public void onCreate() {

    beaconManager = new BeaconManager(getApplicationContext());


    // add this below:
    beaconManager.setMonitoringListener(new BeaconManager.BeaconMonitoringListener() {
        public void onEnteredRegion(BeaconRegion region, List<Beacon> beacons) {
                    "welcome to the clinic!");
        public void onExitedRegion(BeaconRegion region) {


    // add this below:
    beaconManager.connect(new BeaconManager.ServiceReadyCallback() {
        public void onServiceReady() {
            beaconManager.startMonitoring(new BeaconRegion(
                    "monitored region",
                    6632, 59107));

public void showNotification(String title, String message) {
    Intent notifyIntent = new Intent(this, MainActivity.class);
    PendingIntent pendingIntent = PendingIntent.getActivities(this, 0,
            new Intent[] { notifyIntent }, PendingIntent.FLAG_UPDATE_CURRENT);
    Notification notification = new Notification.Builder(this)
    notification.defaults |= Notification.DEFAULT_SOUND;
    NotificationManager notificationManager =
            (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
    notificationManager.notify(1, notification);


I would really really appreciate your help to complete my app :heart: