question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Scanning in separate process not working

See original GitHub issue

Using the library (ranging notifier) inside android service, running in a separate process (android:process tag in manifest) yields no results nor throwing any exception or error. Removing the android:process tag from the services makes the same code work.

Note: I’m not trying to run the service in one process and get the result in main process. Everything regarding AltBeacon is solely in the service (and service’s process).

Expected behavior - I can get results for nearby beacons or get an error if the configuration is wrong

Actual behavior - getting no readings at all nor error that something is awry

Steps to reproduce this behavior - create a service running in a separate process and implement beacon ranging (for example similar to Ranging Example Code here https://altbeacon.github.io/android-beacon-library/samples.html)

Mobile device model and OS version Samsung Galagy S8 running Oreo

Android Beacon Library version 2.16.1

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
bio007commented, Mar 25, 2019

Hi, thanks for additional info. Actually I’ve made some progress.

It more or less works with beaconManager.setEnableScheduledScanJobs(false) and with

        <receiver android:name="org.altbeacon.beacon.startup.StartupBroadcastReceiver"
                  android:process="process.name"
                  tools:replace="process" />
        <service
            android:name="org.altbeacon.beacon.service.BeaconService"
            android:process="process.name"
            tools:replace="process" />
        <service
            android:name="org.altbeacon.beacon.BeaconIntentProcessor"
            android:process="process.name"
            tools:replace="process" />

overridden in manifest.

Only funny thing I see is that even when the app and service is in foreground (running in foreground mode) I’m receiving scans every 5 minutes which is what I set for background scans beaconManager.setBackgroundBetweenScanPeriod(300000L). So it looks to me that it is somehow “operating in backround mode” all the time.

0reactions
davidgyoungcommented, Mar 26, 2019

When you have a service running in a separate process things get strange. Because there are two processes, that means there are two copies of every singleton object. That means two BeaconManager instances and two Application instances. I had to build the library so that is OK. The library detects if the scanning process is separate, and then knows whether the BeaconManager is the one in the main process or the scanning process. Settings are marshalled between the the BeaconManager instance on the main process and the one on the secondary scanning process.

In the reference implementation, both instances of the Application class implement BootstrapNotifier (they must be the same!) but the background scanning variant never starts up RegionBootstrap so it never gets the callbacks. (Confusing, but it works!)

I probably need a deeper explanation of where you set up RegionBootstrap and BackgroundPowerSaver to be helpful. I have not tested other setups.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Fix Scanner Not Working in Windows 10 - Driver Easy
Solution 1: Repair Corrupted System Files · 1) Hold Down Windows logo and press R key at the same time to invoke the...
Read more >
How to Fix Scanner Not Working in Windows 10 [Quick FIX]
How to Fix Scanner Not Working in Windows 10 [Quick FIX]If your HP, Canon, Epson, or any other Scanner is not working on...
Read more >
Troubleshoot scanner issues when scanning using Acrobat
1. Verify that the scanner works by scanning in another application. ... Verify that the scanner works properly by scanning into another ...
Read more >
Troubleshooting Document Processing scans, including OCR
The PaperCut OCR Service could not convert the scan job by {username} on {deviceName} to a searchable format. This error can occur for...
Read more >
Automated Scanner Troubleshooting Utility - HP Support
Resolve HP scanning issues using our HP Print and Scan diagnostic tool or automated HP Virtual Agent or follow manual troubleshooting steps provided...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found