Register today for Oracle CloudWorld. October 17th - 20th, Las Vegas

Register now

Hillel Cooperman, Senior VP of User Experience Design, has a message for you on Oracle CloudWorld

Watch now
Code from Working with Android Beacons video — Cloud Customer Connect
You're almost there! Please answer a few more questions for access to the Applications content. Complete registration
Interested in joining? Complete your registration by providing Areas of Interest here. Register

Code from Working with Android Beacons video

Question
3
Views
0
Comments
edited Jun 20, 2019 4:46AM in Digital Assistant and Mobile

Content

At the request from one of our customers, I'm posting the code to the OMH "Working With Android Beacons" video:

 

Code Snippet

package oracle.com.beaconexample;

import android.Manifest;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.os.RemoteException;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;

import org.altbeacon.beacon.Beacon;
import org.altbeacon.beacon.BeaconConsumer;
import org.altbeacon.beacon.BeaconManager;
import org.altbeacon.beacon.BeaconParser;
import org.altbeacon.beacon.Identifier;
import org.altbeacon.beacon.MonitorNotifier;
import org.altbeacon.beacon.RangeNotifier;
import org.altbeacon.beacon.Region;

import java.util.Collection;
import java.util.List;

import oracle.cloud.mobile.authorization.AuthorizationAgent;
import oracle.cloud.mobile.authorization.AuthorizationCallback;
import oracle.cloud.mobile.exception.ServiceProxyException;
import oracle.cloud.mobile.location.LocationAltBeacon;
import oracle.cloud.mobile.location.LocationDevice;
import oracle.cloud.mobile.location.LocationDeviceContainerQuery;
import oracle.cloud.mobile.location.LocationObject;
import oracle.cloud.mobile.location.LocationObjectQuery;
import oracle.cloud.mobile.location.LocationObjectQueryResult;
import oracle.cloud.mobile.location.LocationObjectsFetchCallback;
import oracle.cloud.mobile.location.LocationObjectsQueryCallback;
import oracle.cloud.mobile.location.LocationPlace;
import oracle.cloud.mobile.location.LocationPlaceQuery;
import oracle.cloud.mobile.mobilebackend.MobileBackend;
import oracle.cloud.mobile.mobilebackend.MobileBackendManager;

public class MainActivity extends AppCompatActivity implements BeaconConsumer {

    private static final String TAG = "MainActivity";

    private Button startButton;
    private Button stopButton;

    private BeaconManager beaconManager = null;
    private Region beaconRegion = null;
    private String beaconMessage = null;

    private static final String ALTBEACON_LAYOUT = "m:2-3=beac,i:4-19,i:20-21,i:22-23,p:24-24,d:25-25";

 

Howdy, Stranger!

Log In

To view full details, sign in.

Register

Don't have an account? Click here to get started!