Search code examples
androideddystonegoogle-beacon-platform

How to get attachments from a Proximity Beacon


I need to get attachments and placeid from a eddystone proximity beacon that already registerd. is any sample applications are available .


Solution

  • Take a look at the Getting Started Section in the Nearby Messages API:

    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        ...
        mMessageListener = new MessageListener() {
            @Override
            public void onFound(Message message) {
                String messageAsString = new String(message.getContent());
                Log.d(TAG, "Found message: " + messageAsString);
            }
    
            @Override
            public void onLost(Message message) {
                String messageAsString = new String(message.getContent());
                Log.d(TAG, "Lost sight of message: " + messageAsString);
            }
        }
    
        ...
    
        // Subscribe to receive messages.
        private void subscribe() {
            Log.i(TAG, "Subscribing.");
            SubscribeOptions options = new SubscribeOptions.Builder()
                .setStrategy(Strategy.BLE_ONLY)
                .build();
            Nearby.Messages.subscribe(mGoogleApiClient, mMessageListener, options);
        }
    }
    

    https://developers.google.com/nearby/messages/android/get-beacon-messages

    You'll find the attachment in the content property of the object "message".