1

Here's what I'm trying to accomplish:

A user walks into a store with a beacon placed. When the user/phone is within X feet of the beacon, the beacon (or maybe the phone?) fires an HTTP request to a server sending the IDFA of the phone to the server (i.e. sends a request to http://myserver.com?idfa=1234324234234234 ).

Is this possible using beacons?

user324324
  • 89
  • 1
  • 2
  • 5

1 Answers1

0

Yes,It´s possible.

You can implement it on the phone side with a library called AltBeacon, here you have the specs site

You just need to implement the beacon ranging function to your Activity and then send an http call to your server with the info taken from the found/nearby beacon.

Here you have a working example from the same AltBeacon repository.

https://github.com/AltBeacon/android-beacon-library-reference/blob/master/app/src/main/java/org/altbeacon/beaconreference/RangingActivity.java

This is just a except so you can see how easy it is to range beacons.

@Override
    public void onBeaconServiceConnect() {
        beaconManager.setRangeNotifier(new RangeNotifier() {
           @Override
           public void didRangeBeaconsInRegion(Collection<Beacon> beacons, Region region) {
              if (beacons.size() > 0) {
                 //EditText editText = (EditText)RangingActivity.this.findViewById(R.id.rangingText);
                 Beacon firstBeacon = beacons.iterator().next();
                 logToDisplay("The first beacon " + firstBeacon.toString() + " is about " + firstBeacon.getDistance() + " meters away.");
              }
           }

        });

        try {
            beaconManager.startRangingBeaconsInRegion(new Region("myRangingUniqueId", null, null, null));
        } catch (RemoteException e) {   }
    }
reixa
  • 6,903
  • 6
  • 49
  • 68