Android device can't scan beacon











up vote
0
down vote

favorite












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 at 5:28










  • @RickyMo Of course that
    – Polaris Nation
    Nov 20 at 5:35










  • Did this solve the problem?
    – davidgyoung
    Nov 20 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 at 8:35

















up vote
0
down vote

favorite












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 at 5:28










  • @RickyMo Of course that
    – Polaris Nation
    Nov 20 at 5:35










  • Did this solve the problem?
    – davidgyoung
    Nov 20 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 at 8:35















up vote
0
down vote

favorite









up vote
0
down vote

favorite











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 at 5:36

























asked Nov 20 at 2:34









Polaris Nation

139117




139117












  • Maybe worth checking that if the location permission is granted to the app on the phone?
    – Ricky Mo
    Nov 20 at 5:28










  • @RickyMo Of course that
    – Polaris Nation
    Nov 20 at 5:35










  • Did this solve the problem?
    – davidgyoung
    Nov 20 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 at 8:35




















  • Maybe worth checking that if the location permission is granted to the app on the phone?
    – Ricky Mo
    Nov 20 at 5:28










  • @RickyMo Of course that
    – Polaris Nation
    Nov 20 at 5:35










  • Did this solve the problem?
    – davidgyoung
    Nov 20 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 at 8:35


















Maybe worth checking that if the location permission is granted to the app on the phone?
– Ricky Mo
Nov 20 at 5:28




Maybe worth checking that if the location permission is granted to the app on the phone?
– Ricky Mo
Nov 20 at 5:28












@RickyMo Of course that
– Polaris Nation
Nov 20 at 5:35




@RickyMo Of course that
– Polaris Nation
Nov 20 at 5:35












Did this solve the problem?
– davidgyoung
Nov 20 at 11:49




Did this solve the problem?
– davidgyoung
Nov 20 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 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 at 8:35














1 Answer
1






active

oldest

votes

















up vote
0
down vote













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 at 5:00










  • defaultRegion = new Region("BeaconIdentifier", null, null, null); but still can't scan..
    – Polaris Nation
    Nov 20 at 5:37










  • I test another C device (API 24, Marshmellow, galaxy J7 2016), but still can't
    – Polaris Nation
    Nov 20 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',
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








up vote
0
down vote













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 at 5:00










  • defaultRegion = new Region("BeaconIdentifier", null, null, null); but still can't scan..
    – Polaris Nation
    Nov 20 at 5:37










  • I test another C device (API 24, Marshmellow, galaxy J7 2016), but still can't
    – Polaris Nation
    Nov 20 at 5:38















up vote
0
down vote













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 at 5:00










  • defaultRegion = new Region("BeaconIdentifier", null, null, null); but still can't scan..
    – Polaris Nation
    Nov 20 at 5:37










  • I test another C device (API 24, Marshmellow, galaxy J7 2016), but still can't
    – Polaris Nation
    Nov 20 at 5:38













up vote
0
down vote










up vote
0
down vote









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 at 3:39









davidgyoung

48.1k1075137




48.1k1075137












  • 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 at 5:00










  • defaultRegion = new Region("BeaconIdentifier", null, null, null); but still can't scan..
    – Polaris Nation
    Nov 20 at 5:37










  • I test another C device (API 24, Marshmellow, galaxy J7 2016), but still can't
    – Polaris Nation
    Nov 20 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 at 5:00










  • defaultRegion = new Region("BeaconIdentifier", null, null, null); but still can't scan..
    – Polaris Nation
    Nov 20 at 5:37










  • I test another C device (API 24, Marshmellow, galaxy J7 2016), but still can't
    – Polaris Nation
    Nov 20 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 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 at 5:00












defaultRegion = new Region("BeaconIdentifier", null, null, null); but still can't scan..
– Polaris Nation
Nov 20 at 5:37




defaultRegion = new Region("BeaconIdentifier", null, null, null); but still can't scan..
– Polaris Nation
Nov 20 at 5:37












I test another C device (API 24, Marshmellow, galaxy J7 2016), but still can't
– Polaris Nation
Nov 20 at 5:38




I test another C device (API 24, Marshmellow, galaxy J7 2016), but still can't
– Polaris Nation
Nov 20 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.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • 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

404 Error Contact Form 7 ajax form submitting

How to know if a Active Directory user can login interactively

Refactoring coordinates for Minecraft Pi buildings written in Python