Android-Proximity-SDK icon indicating copy to clipboard operation
Android-Proximity-SDK copied to clipboard

Proximity for Multiple Beacons not working

Open rajeshkanna777 opened this issue 7 years ago • 4 comments

The Proximity for Multiple Beacons source code download from estimote cloud, After that i changed version form 0.3.3 to 0.5.1 implementation 'com.estimote:proximity-sdk:0.5.1'

This package can not reslove import com.estimote.cloud_plugin.common.EstimoteCloudCredentials; so i changed to tis import com.estimote.proximity_sdk.proximity.EstimoteCloudCredentials;

Estimote SDK version: 0.5.1

**Android devices affected:**samsung galaxy j7 prime ,android 7

Android OS version affected: [Android OS version (ex. Oreo 8.0.0)] device : samsung galaxy j7 prime Os :android 7

**Beacon hardware version:**G1.8

Description

Proximity for Multiple Beacons not working i did not see any error.

Code

Class 1 private ProximityContentManager proximityContentManager;

RequirementsWizardFactory .createEstimoteRequirementsWizard() .fulfillRequirements(MainActivity.this, new Function0<Unit>() { @Override public Unit invoke() { Log.d("app", "requirements fulfilled"); startProximityContentManager(); return null; } }, new Function1<List<? extends Requirement>, Unit>() { @Override public Unit invoke(List<? extends Requirement> requirements) { Log.e("app", "requirements missing: " + requirements); return null; } }, new Function1<Throwable, Unit>() { @Override public Unit invoke(Throwable throwable) { Log.e("app", "requirements error: " + throwable); return null; } });

private void startProximityContentManager() { proximityContentManager = new ProximityContentManager(this, proximityContentAdapter, ((MyApplication) getApplication()).cloudCredentials); proximityContentManager.start(); }

Class 2

public void start() { ProximityObserver proximityObserver = new ProximityObserverBuilder(context, (EstimoteCloudCredentials) cloudCredentials) .withBalancedPowerMode() .withOnErrorAction(new Function1<Throwable, Unit>() { @Override public Unit invoke(Throwable throwable) { Log.e("app", "proximity observer error: " + throwable); return null; } }) .build(); ProximityZone zone = proximityObserver.zoneBuilder() .forAttachmentKeyAndValue("dev4wrkspot-gmail-com-s-pr-o0v", "example-proximity-zone") .inCustomRange(7.0) .withOnChangeAction(new Function1<List<? extends ProximityAttachment>, Unit>() { @Override public Unit invoke(List<? extends ProximityAttachment> attachments) {

                    List<ProximityContent> nearbyContent = new ArrayList<>(attachments.size());

                    for (ProximityAttachment attachment : attachments) {
                        String title = attachment.getPayload().get("dev4wrkspot-gmail-com-s-pr-o0v/title");
                        if (title == null) {
                            title = "unknown";
                        }
                        String subtitle = Utils.getShortIdentifier(attachment.getDeviceId());

                        nearbyContent.add(new ProximityContent(title, subtitle));
                    }

                    proximityContentAdapter.setNearbyContent(nearbyContent);
                    proximityContentAdapter.notifyDataSetChanged();

                    return null;
                }
            })
            .create();
    proximityObserver.addProximityZone(zone);

    proximityObserverHandler = proximityObserver.start();
}

I got this log 2018-06-12 13:17:01.547 12174-12499/com.estimote.proximitycontent D/ScanRecord: parseFromBytes 2018-06-12 13:17:01.547 12174-12499/com.estimote.proximitycontent D/ScanRecord: first manudata for manu ID 2018-06-12 13:17:01.547 12174-12513/com.estimote.proximitycontent D/ScanRecord: parseFromBytes 2018-06-12 13:17:01.547 12174-12496/com.estimote.proximitycontent D/ScanRecord: parseFromBytes 2018-06-12 13:17:01.547 12174-12513/com.estimote.proximitycontent D/ScanRecord: first manudata for manu ID 2018-06-12 13:17:01.547 12174-12496/com.estimote.proximitycontent D/ScanRecord: first manudata for manu ID 2018-06-12 13:17:01.548 12174-12186/com.estimote.proximitycontent D/ScanRecord: parseFromBytes 2018-06-12 13:17:01.548 12174-12186/com.estimote.proximitycontent D/ScanRecord: first manudata for manu ID 2018-06-12 13:17:01.549 12174-12497/com.estimote.proximitycontent D/ScanRecord: parseFromBytes 2018-06-12 13:17:01.549 12174-12472/com.estimote.proximitycontent D/ScanRecord: parseFromBytes 2018-06-12 13:17:01.549 12174-12497/com.estimote.proximitycontent D/ScanRecord: first manudata for manu ID 2018-06-12 13:17:01.549 12174-12473/com.estimote.proximitycontent D/ScanRecord: parseFromBytes 2018-06-12 13:17:01.549 12174-12472/com.estimote.proximitycontent D/ScanRecord: first manudata for manu ID 2018-06-12 13:17:01.549 12174-12473/com.estimote.proximitycontent D/ScanRecord: first manudata for manu ID 2018-06-12 13:17:01.550 12174-12512/com.estimote.proximitycontent D/ScanRecord: parseFromBytes 2018-06-12 13:17:01.550 12174-12512/com.estimote.proximitycontent D/ScanRecord: first manudata for manu ID 2018-06-12 13:17:01.550 12174-12187/com.estimote.proximitycontent D/ScanRecord: parseFromBytes 2018-06-12 13:17:01.550 12174-12187/com.estimote.proximitycontent D/ScanRecord: first manudata for manu ID 2018-06-12 13:17:01.558 12174-12499/com.estimote.proximitycontent D/ScanRecord: parseFromBytes 2018-06-12 13:17:01.558 12174-12787/com.estimote.proximitycontent D/ScanRecord: parseFromBytes 2018-06-12 13:17:01.558 12174-12787/com.estimote.proximitycontent D/ScanRecord: parseFromBytes 2018-06-12 13:17:01.558 12174-12513/com.estimote.proximitycontent D/ScanRecord: parseFromBytes

rajeshkanna777 avatar Jun 12 '18 07:06 rajeshkanna777

i still did not get any response form there last 20 days , can any one help me this issues

rajeshkanna777 avatar Jul 02 '18 06:07 rajeshkanna777

Hey @rajeshkanna777 , I'm not associated with Estimote or anything, but I have been developing an Android app with their SDK for about a month now.

What I observe here is that the SDK update broke your code due to the library changes. (Check out their updated tutorial to rework your code.)

To pinpoint a specific problem, lets look at your proximity zone zone.

Firstly,

ProximityZone zone = proximityObserver.zoneBuilder()
.forAttachmentKeyAndValue("dev4wrkspot-gmail-com-s-pr-o0v", "example-proximity-zone")
.inCustomRange(7.0)

should now be:

ProximityZone zone = proximityObserver.zoneBuilder()
.forTag("dev4wrkspot-gmail-com-s-pr-o0v") // the tag is arbitrary, but I reused your app id
.inCustomRange(7.0)

Next,

.....
.withOnChangeAction(new Function1<List<? extends ProximityAttachment>, Unit>() {
@override
public Unit invoke(List<? extends ProximityAttachment> attachments) {

                    List<ProximityContent> nearbyContent = new ArrayList<>(attachments.size());

                    for (ProximityAttachment attachment : attachments) {
                        String title = attachment.getPayload().get("dev4wrkspot-gmail-com-s-pr-o0v/title");
                        if (title == null) {
                            title = "unknown";
                        }
                        String subtitle = Utils.getShortIdentifier(attachment.getDeviceId());

                        nearbyContent.add(new ProximityContent(title, subtitle));
                    }

                    proximityContentAdapter.setNearbyContent(nearbyContent);
                    proximityContentAdapter.notifyDataSetChanged();

                    return null;
                }
            })
            .create();

should be:

.....
.withOnChangeAction(new Function1<List<? extends ProximityContext>, Unit>() {
@override
public Unit invoke(List<? extends ProximityContext> contexts) {
          List<ProximityContent> nearbyContent = new ArrayList<>(attachments.size());

           for (ProximityContext context : contexts) {
              String title = context.getAttachments().get("title");

              if (title == null) {
                  title = "unknown";
              }

              String subtitle = context.getInfo().getDeviceId();

              nearbyContent.add(new ProximityContent(title, subtitle));
          }
.....

I assume that ProximityContent exists, but I have never heard of, or used, it.

VERY IMPORTANT: Be sure to give the affected beacons the tag dev4wrkspot-gmail-com-s-pr-o0v, and change their attachment keys from dev4wrkspot-gmail-com-s-pr-o0v\title to just title, if you want my edit to work (remember, tags are arbitrary, just be consistent).

Hope this helps!

Walt-H avatar Jul 02 '18 13:07 Walt-H

Still not working ,Can you check my setting and doing correct or not screen shot 2018-07-04 at 8 12 31 pm screen shot 2018-07-04 at 8 12 44 pm screen shot 2018-07-04 at 8 13 08 pm screen shot 2018-07-04 at 8 13 17 pm

my Total code

    ProximityObserver proximityObserver = new ProximityObserverBuilder(context, cloudCredentials)
            .withOnErrorAction(new Function1<Throwable, Unit>() {
                @Override
                public Unit invoke(Throwable throwable) {
                    Log.e("app", "proximity observer error: " + throwable);
                    return null;
                }
            })
            .withBalancedPowerMode()
            .build();

    ProximityZone zone = proximityObserver.zoneBuilder()
            .forTag("TestBeacon") // the tag is arbitrary, but I reused your app id
            .inNearRange()
            .withOnChangeAction(new Function1<List<? extends ProximityContext>, Unit>() {
                public Unit invoke(List<? extends ProximityContext> contexts) {
                    List<ProximityContent> nearbyContent = new ArrayList<>(contexts.size());

                    for (ProximityContext context : contexts) {
                        String title = context.getAttachments().get("desk-owne");

                        if (title == null) {
                            title = "unknown";
                        }

                        String subtitle = context.getInfo().getDeviceId();

                        nearbyContent.add(new ProximityContent(title, subtitle));
                    }

                    proximityContentAdapter.setNearbyContent(nearbyContent);
                    proximityContentAdapter.notifyDataSetChanged();

                    return null;
                }
            })
            .create();


    proximityObserver.addProximityZone(zone);

    proximityObserverHandler = proximityObserver.start();

rajeshkanna777 avatar Jul 04 '18 14:07 rajeshkanna777

Hey @rajeshkanna777, I was only addressing one of several problems with the code.

However, if you upload your code to a repo and share me on it, then I would be more than happy to get your code to build :)

In addition, you do need to change your beacon settings.

Feel free to private message me.

Walt-H avatar Jul 04 '18 16:07 Walt-H