Android device can't scan beacon












0















I'm working on a simple beacon proximity app using AltBeacon library from here https://altbeacon.github.io/android-beacon-library/samples.html.



I am experimenting with the sample code provided on the above website, however, each time I run the app it only goes to addRangingNotifier() method. If it detected the beacon it would go log the beacon size.



private Region defaultRegion = null;
defaultRegion = new Region("BeaconIdentifier", Identifier.fromUuid(java.util.UUID.fromString(UUID)), null, null);
beaconManager = BeaconManager.getInstanceForApplication(this);
beaconManager.getBeaconParsers().add(new BeaconParser().setBeaconLayout("m:2-3=0215,i:4-19,i:20-21,i:22-23,p:24-24"));
beaconManager.bind(this);

@Override
public void onBeaconServiceConnect() {
beaconManager.addRangeNotifier(new RangeNotifier() {
@Override
public void didRangeBeaconsInRegion(Collection<Beacon> beacons, Region region) {
if (beacons.size() > 0) {
Log.d("MainInfo","Beacon List Size " + beacons.size());
}else{
Log.d("MainInfo","Beacon Empty");
}
}
});
try {
beaconManager.startRangingBeaconsInRegion(defaultRegion);
} catch (RemoteException e) {}
}


I can receive the beacon size around of me.
I test the two device(A : Samsung galaxy J510-Marshmellow/B: Samsung galaxy J7-Nougat), B scan the beacon and print Beacon List Size, but, A can't scan the beacon and print Beacon Empty.



So I test same Marshmellow device, but I can't find it.



Are there any codes that should be added depending on the operating system?










share|improve this question

























  • Maybe worth checking that if the location permission is granted to the app on the phone?

    – Ricky Mo
    Nov 20 '18 at 5:28











  • @RickyMo Of course that

    – Polaris Nation
    Nov 20 '18 at 5:35











  • Did this solve the problem?

    – davidgyoung
    Nov 20 '18 at 11:49











  • @davidgyoung yes. when I change dependencies { implementation 'org.altbeacon:android-beacon-library:2+' } to AAR file (in project structure and import aar file), it show the scan result. So now I can scan. Thank you for your answer

    – Polaris Nation
    Nov 21 '18 at 8:35


















0















I'm working on a simple beacon proximity app using AltBeacon library from here https://altbeacon.github.io/android-beacon-library/samples.html.



I am experimenting with the sample code provided on the above website, however, each time I run the app it only goes to addRangingNotifier() method. If it detected the beacon it would go log the beacon size.



private Region defaultRegion = null;
defaultRegion = new Region("BeaconIdentifier", Identifier.fromUuid(java.util.UUID.fromString(UUID)), null, null);
beaconManager = BeaconManager.getInstanceForApplication(this);
beaconManager.getBeaconParsers().add(new BeaconParser().setBeaconLayout("m:2-3=0215,i:4-19,i:20-21,i:22-23,p:24-24"));
beaconManager.bind(this);

@Override
public void onBeaconServiceConnect() {
beaconManager.addRangeNotifier(new RangeNotifier() {
@Override
public void didRangeBeaconsInRegion(Collection<Beacon> beacons, Region region) {
if (beacons.size() > 0) {
Log.d("MainInfo","Beacon List Size " + beacons.size());
}else{
Log.d("MainInfo","Beacon Empty");
}
}
});
try {
beaconManager.startRangingBeaconsInRegion(defaultRegion);
} catch (RemoteException e) {}
}


I can receive the beacon size around of me.
I test the two device(A : Samsung galaxy J510-Marshmellow/B: Samsung galaxy J7-Nougat), B scan the beacon and print Beacon List Size, but, A can't scan the beacon and print Beacon Empty.



So I test same Marshmellow device, but I can't find it.



Are there any codes that should be added depending on the operating system?










share|improve this question

























  • Maybe worth checking that if the location permission is granted to the app on the phone?

    – Ricky Mo
    Nov 20 '18 at 5:28











  • @RickyMo Of course that

    – Polaris Nation
    Nov 20 '18 at 5:35











  • Did this solve the problem?

    – davidgyoung
    Nov 20 '18 at 11:49











  • @davidgyoung yes. when I change dependencies { implementation 'org.altbeacon:android-beacon-library:2+' } to AAR file (in project structure and import aar file), it show the scan result. So now I can scan. Thank you for your answer

    – Polaris Nation
    Nov 21 '18 at 8:35
















0












0








0








I'm working on a simple beacon proximity app using AltBeacon library from here https://altbeacon.github.io/android-beacon-library/samples.html.



I am experimenting with the sample code provided on the above website, however, each time I run the app it only goes to addRangingNotifier() method. If it detected the beacon it would go log the beacon size.



private Region defaultRegion = null;
defaultRegion = new Region("BeaconIdentifier", Identifier.fromUuid(java.util.UUID.fromString(UUID)), null, null);
beaconManager = BeaconManager.getInstanceForApplication(this);
beaconManager.getBeaconParsers().add(new BeaconParser().setBeaconLayout("m:2-3=0215,i:4-19,i:20-21,i:22-23,p:24-24"));
beaconManager.bind(this);

@Override
public void onBeaconServiceConnect() {
beaconManager.addRangeNotifier(new RangeNotifier() {
@Override
public void didRangeBeaconsInRegion(Collection<Beacon> beacons, Region region) {
if (beacons.size() > 0) {
Log.d("MainInfo","Beacon List Size " + beacons.size());
}else{
Log.d("MainInfo","Beacon Empty");
}
}
});
try {
beaconManager.startRangingBeaconsInRegion(defaultRegion);
} catch (RemoteException e) {}
}


I can receive the beacon size around of me.
I test the two device(A : Samsung galaxy J510-Marshmellow/B: Samsung galaxy J7-Nougat), B scan the beacon and print Beacon List Size, but, A can't scan the beacon and print Beacon Empty.



So I test same Marshmellow device, but I can't find it.



Are there any codes that should be added depending on the operating system?










share|improve this question
















I'm working on a simple beacon proximity app using AltBeacon library from here https://altbeacon.github.io/android-beacon-library/samples.html.



I am experimenting with the sample code provided on the above website, however, each time I run the app it only goes to addRangingNotifier() method. If it detected the beacon it would go log the beacon size.



private Region defaultRegion = null;
defaultRegion = new Region("BeaconIdentifier", Identifier.fromUuid(java.util.UUID.fromString(UUID)), null, null);
beaconManager = BeaconManager.getInstanceForApplication(this);
beaconManager.getBeaconParsers().add(new BeaconParser().setBeaconLayout("m:2-3=0215,i:4-19,i:20-21,i:22-23,p:24-24"));
beaconManager.bind(this);

@Override
public void onBeaconServiceConnect() {
beaconManager.addRangeNotifier(new RangeNotifier() {
@Override
public void didRangeBeaconsInRegion(Collection<Beacon> beacons, Region region) {
if (beacons.size() > 0) {
Log.d("MainInfo","Beacon List Size " + beacons.size());
}else{
Log.d("MainInfo","Beacon Empty");
}
}
});
try {
beaconManager.startRangingBeaconsInRegion(defaultRegion);
} catch (RemoteException e) {}
}


I can receive the beacon size around of me.
I test the two device(A : Samsung galaxy J510-Marshmellow/B: Samsung galaxy J7-Nougat), B scan the beacon and print Beacon List Size, but, A can't scan the beacon and print Beacon Empty.



So I test same Marshmellow device, but I can't find it.



Are there any codes that should be added depending on the operating system?







android beacon






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 20 '18 at 5:36







Polaris Nation

















asked Nov 20 '18 at 2:34









Polaris NationPolaris Nation

188218




188218













  • Maybe worth checking that if the location permission is granted to the app on the phone?

    – Ricky Mo
    Nov 20 '18 at 5:28











  • @RickyMo Of course that

    – Polaris Nation
    Nov 20 '18 at 5:35











  • Did this solve the problem?

    – davidgyoung
    Nov 20 '18 at 11:49











  • @davidgyoung yes. when I change dependencies { implementation 'org.altbeacon:android-beacon-library:2+' } to AAR file (in project structure and import aar file), it show the scan result. So now I can scan. Thank you for your answer

    – Polaris Nation
    Nov 21 '18 at 8:35





















  • Maybe worth checking that if the location permission is granted to the app on the phone?

    – Ricky Mo
    Nov 20 '18 at 5:28











  • @RickyMo Of course that

    – Polaris Nation
    Nov 20 '18 at 5:35











  • Did this solve the problem?

    – davidgyoung
    Nov 20 '18 at 11:49











  • @davidgyoung yes. when I change dependencies { implementation 'org.altbeacon:android-beacon-library:2+' } to AAR file (in project structure and import aar file), it show the scan result. So now I can scan. Thank you for your answer

    – Polaris Nation
    Nov 21 '18 at 8:35



















Maybe worth checking that if the location permission is granted to the app on the phone?

– Ricky Mo
Nov 20 '18 at 5:28





Maybe worth checking that if the location permission is granted to the app on the phone?

– Ricky Mo
Nov 20 '18 at 5:28













@RickyMo Of course that

– Polaris Nation
Nov 20 '18 at 5:35





@RickyMo Of course that

– Polaris Nation
Nov 20 '18 at 5:35













Did this solve the problem?

– davidgyoung
Nov 20 '18 at 11:49





Did this solve the problem?

– davidgyoung
Nov 20 '18 at 11:49













@davidgyoung yes. when I change dependencies { implementation 'org.altbeacon:android-beacon-library:2+' } to AAR file (in project structure and import aar file), it show the scan result. So now I can scan. Thank you for your answer

– Polaris Nation
Nov 21 '18 at 8:35







@davidgyoung yes. when I change dependencies { implementation 'org.altbeacon:android-beacon-library:2+' } to AAR file (in project structure and import aar file), it show the scan result. So now I can scan. Thank you for your answer

– Polaris Nation
Nov 21 '18 at 8:35














1 Answer
1






active

oldest

votes


















1














The most likely thing wrong is that the UUID specified does not match your beacon. Try replacing this code:



  Identifier.fromUuid(java.util.UUID.fromString(UUID))


With



  null


To match all beacons. If this fixes it, replace the UUID with the one you are out of the detected beacon.






share|improve this answer
























  • Ok I'll test it. but I suggest why B device can scan it, but A device can't scan it. If UUID is wrong, I guess B device also can't scan it.

    – Polaris Nation
    Nov 20 '18 at 5:00











  • defaultRegion = new Region("BeaconIdentifier", null, null, null); but still can't scan..

    – Polaris Nation
    Nov 20 '18 at 5:37











  • I test another C device (API 24, Marshmellow, galaxy J7 2016), but still can't

    – Polaris Nation
    Nov 20 '18 at 5:38











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53385394%2fandroid-device-cant-scan-beacon%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









1














The most likely thing wrong is that the UUID specified does not match your beacon. Try replacing this code:



  Identifier.fromUuid(java.util.UUID.fromString(UUID))


With



  null


To match all beacons. If this fixes it, replace the UUID with the one you are out of the detected beacon.






share|improve this answer
























  • Ok I'll test it. but I suggest why B device can scan it, but A device can't scan it. If UUID is wrong, I guess B device also can't scan it.

    – Polaris Nation
    Nov 20 '18 at 5:00











  • defaultRegion = new Region("BeaconIdentifier", null, null, null); but still can't scan..

    – Polaris Nation
    Nov 20 '18 at 5:37











  • I test another C device (API 24, Marshmellow, galaxy J7 2016), but still can't

    – Polaris Nation
    Nov 20 '18 at 5:38
















1














The most likely thing wrong is that the UUID specified does not match your beacon. Try replacing this code:



  Identifier.fromUuid(java.util.UUID.fromString(UUID))


With



  null


To match all beacons. If this fixes it, replace the UUID with the one you are out of the detected beacon.






share|improve this answer
























  • Ok I'll test it. but I suggest why B device can scan it, but A device can't scan it. If UUID is wrong, I guess B device also can't scan it.

    – Polaris Nation
    Nov 20 '18 at 5:00











  • defaultRegion = new Region("BeaconIdentifier", null, null, null); but still can't scan..

    – Polaris Nation
    Nov 20 '18 at 5:37











  • I test another C device (API 24, Marshmellow, galaxy J7 2016), but still can't

    – Polaris Nation
    Nov 20 '18 at 5:38














1












1








1







The most likely thing wrong is that the UUID specified does not match your beacon. Try replacing this code:



  Identifier.fromUuid(java.util.UUID.fromString(UUID))


With



  null


To match all beacons. If this fixes it, replace the UUID with the one you are out of the detected beacon.






share|improve this answer













The most likely thing wrong is that the UUID specified does not match your beacon. Try replacing this code:



  Identifier.fromUuid(java.util.UUID.fromString(UUID))


With



  null


To match all beacons. If this fixes it, replace the UUID with the one you are out of the detected beacon.







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 20 '18 at 3:39









davidgyoungdavidgyoung

48.6k1076138




48.6k1076138













  • Ok I'll test it. but I suggest why B device can scan it, but A device can't scan it. If UUID is wrong, I guess B device also can't scan it.

    – Polaris Nation
    Nov 20 '18 at 5:00











  • defaultRegion = new Region("BeaconIdentifier", null, null, null); but still can't scan..

    – Polaris Nation
    Nov 20 '18 at 5:37











  • I test another C device (API 24, Marshmellow, galaxy J7 2016), but still can't

    – Polaris Nation
    Nov 20 '18 at 5:38



















  • Ok I'll test it. but I suggest why B device can scan it, but A device can't scan it. If UUID is wrong, I guess B device also can't scan it.

    – Polaris Nation
    Nov 20 '18 at 5:00











  • defaultRegion = new Region("BeaconIdentifier", null, null, null); but still can't scan..

    – Polaris Nation
    Nov 20 '18 at 5:37











  • I test another C device (API 24, Marshmellow, galaxy J7 2016), but still can't

    – Polaris Nation
    Nov 20 '18 at 5:38

















Ok I'll test it. but I suggest why B device can scan it, but A device can't scan it. If UUID is wrong, I guess B device also can't scan it.

– Polaris Nation
Nov 20 '18 at 5:00





Ok I'll test it. but I suggest why B device can scan it, but A device can't scan it. If UUID is wrong, I guess B device also can't scan it.

– Polaris Nation
Nov 20 '18 at 5:00













defaultRegion = new Region("BeaconIdentifier", null, null, null); but still can't scan..

– Polaris Nation
Nov 20 '18 at 5:37





defaultRegion = new Region("BeaconIdentifier", null, null, null); but still can't scan..

– Polaris Nation
Nov 20 '18 at 5:37













I test another C device (API 24, Marshmellow, galaxy J7 2016), but still can't

– Polaris Nation
Nov 20 '18 at 5:38





I test another C device (API 24, Marshmellow, galaxy J7 2016), but still can't

– Polaris Nation
Nov 20 '18 at 5:38


















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53385394%2fandroid-device-cant-scan-beacon%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Can a sorcerer learn a 5th-level spell early by creating spell slots using the Font of Magic feature?

Does disintegrating a polymorphed enemy still kill it after the 2018 errata?

A Topological Invariant for $pi_3(U(n))$