Skip to content

Snappy1

  • Home
  • Android
  • What
  • How
  • Is
  • Can
  • Does
  • Do
  • Why
  • Are
  • Who
  • Toggle search form

[FIXED] android – Altbeacon BLE Library no detection on Samsung Galaxy A51

Posted on November 11, 2022 By

Solution 1 :

There is no need to manually add a scan filter with the Android Beacon Library. The library adds filters automatically as needed for Samsung and other Android models. Per the documentation, the only time it needs help is if a non-standard beacon is being used that uses a custom manufacturer identifier. In this rare case the library needs to be told that custom manufacturer identifier for the automatic scan filter to work.

Since this is not what is causing the problem with detections something else must be. A few suggestions:

  1. Use an off the shelf app like BeaconScope that is also based on this library. Does it detect your beacon?
  2. If the answer to the above is no, are you sure the beacon is transmitting and has the format you think?
  3. If the answer to (1) is yes, focus first on getting the library’s reference app to work with your beacon, and modify it slowly until it matches the code you have now.

Problem :

I am trying to do simple BLE Beacon monitoring using the provided sample app. I do not get any detections on a Samsung Galaxy A51.

According to the documentation, this is expected since i am using an empty scan filer. What I am struggling with is identifying how and where to apply these scan filters in the provided reference app, as it is using this code:

    public void onCreate() {
        super.onCreate();
        BeaconManager beaconManager = org.altbeacon.beacon.BeaconManager.getInstanceForApplication(this);

        beaconManager.getBeaconParsers().clear();
        beaconManager.getBeaconParsers().add(new BeaconParser().
                setBeaconLayout("m:2-3=0215,i:4-19,i:20-21,i:22-23,p:24-24"));

        Notification.Builder builder = new Notification.Builder(this);
        builder.setSmallIcon(R.drawable.ic_launcher);
        builder.setContentTitle("Scanning for Beacons");
        Intent intent = new Intent(this, MonitoringActivity.class);
        PendingIntent pendingIntent = PendingIntent.getActivity(
                this, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT
        );
        builder.setContentIntent(pendingIntent);
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
            NotificationChannel channel = new NotificationChannel("My Notification Channel ID",
                    "My Notification Name", NotificationManager.IMPORTANCE_DEFAULT);
            channel.setDescription("My Notification Channel Description");
            NotificationManager notificationManager = (NotificationManager) getSystemService(
                    Context.NOTIFICATION_SERVICE);
            notificationManager.createNotificationChannel(channel);
            builder.setChannelId(channel.getId());
        }
        beaconManager.enableForegroundServiceScanning(builder.build(), 456);

        beaconManager.setEnableScheduledScanJobs(false);
        beaconManager.setBackgroundBetweenScanPeriod(0);
        beaconManager.setBackgroundScanPeriod(1100);



        Log.d(TAG, "setting up background monitoring in app onCreate");
        beaconManager.addMonitorNotifier(this);

        for (Region region: beaconManager.getMonitoredRegions()) {
            beaconManager.stopMonitoring(region);
        }

        beaconManager.startMonitoring(wildcardRegion);
    }

Comments

Comment posted by DaVincr

Hello David, thank you for your insights. How would I know if my beacon is a non-standard one? Where in the provided code would i assign the custom manufacturer identifier? 1. BeaconScope does not detect the beacon on the A51. It does on the Motorola. 2. I am sure the beacon is submitting since the signal is picked up on the motorola device.

READ  [FIXED] android - ConstraintLayout - how to wrap over RecyclerView
Powered by Inline Related Posts

Comment posted by ibb.co/hy5m3JB

ibb.co/hy5m3JB

Comment posted by DaVincr

I have found the issue. The devices causing the problems had the global location setting deactived while I only checked for app-specific permissions. Thank you for your help David.

Comment posted by davidgyoung

OK, good. Yes, the phone setting for location on/off is a key thing to check!

Android Tags:altbeacon, android, bluetooth-lowenergy

Post navigation

Previous Post: [FIXED] android – LottieAnimationView doesn’t show in my_layout.xml
Next Post: [FIXED] android – Firestore conditional array query

Related Posts

[FIXED] android – What do I supply to “LifeCycleOwner” parameter on observe in Kotlin? Android
[FIXED] java – HC-05 Multiple data sending to android studio app Android
[FIXED] android – I am getting error when I build the application in flutter Android
[FIXED] android – Xamarin Forms Build Failing: Missing dx.jar Android
[FIXED] Android SDK Platform option cannot be ticked/selected in Android Studio Setup Wizard Android
[FIXED] java – How to properly initialize value from firebase with model class Android

Archives

  • March 2023
  • February 2023
  • January 2023
  • December 2022
  • November 2022
  • October 2022
  • September 2022

Categories

  • ¿Cómo
  • ¿Cuál
  • ¿Cuándo
  • ¿Cuántas
  • ¿Cuánto
  • ¿Qué
  • Android
  • Are
  • At
  • C'est
  • Can
  • Comment
  • Did
  • Do
  • Does
  • Est-ce
  • Est-il
  • For
  • Has
  • Hat
  • How
  • In
  • Is
  • Ist
  • Kann
  • Où
  • Pourquoi
  • Quand
  • Quel
  • Quelle
  • Quelles
  • Quels
  • Qui
  • Should
  • Sind
  • Sollte
  • Uncategorized
  • Wann
  • Warum
  • Was
  • Welche
  • Welchen
  • Welcher
  • Welches
  • Were
  • What
  • What's
  • When
  • Where
  • Which
  • Who
  • Who's
  • Why
  • Wie
  • Will
  • Wird
  • Wo
  • Woher
  • you can create a selvedge edge: You can make the edges of garter stitch more smooth by slipping the first stitch of every row.2022-02-04
  • you really only need to know two patterns: garter stitch

Recent Posts

  • What is a good substitute for condensed milk?
  • ¿Como el cuerpo te avisa cuando te va a dar un infarto?
  • What is the luxury brand of Jaguar?
  • Who is Big poppa baseball player?
  • What material are foam runners?

Recent Comments

No comments to show.

Copyright © 2023 Snappy1.

Powered by PressBook Grid Dark theme