AltBeacon onBeaconServiceConnect not called
Asked Answered
W

1

6

I stuck implementing simple Beacon monitor with AltBeacon library using its examples. In short: I took its reference application, downloaded and integrated its latest build and run app on my Samsung Galaxy S2 with CM (Android 4.4.4). I see that onBeaconServiceConnect callback never called, though bindService is called. I believe onBeaconServiceConnect should be called in order application to work correctly.

I've tried to set beaconManager.debug = true; but it didn't show me any new logs (maybe because I'm using precompiled libraries from site).

Also I've checked if the problem with my firmware/hardware - but I see it's able to monitor beacons with other applications from Google Play. I have iPhone and MacBook and one more android device so I can simulate any transmitting signal which is needed to let AltBeacon catch it.

Can someone help me? I would appreciate any clue you give me!

Winters answered 30/8, 2014 at 8:47 Comment(0)
Y
8

A failure to receive a callback to onBeaconServiceConnect is usually caused by an incorrect AndroidManifest.xml setup to declare the BeaconService. The library uses manifest merging to automatically merge these definitions into your app's AndroidManifest.xml from the library's AndroidManifest.xml at compile time. If manifest merging is not enabled, the service will never be declared and the app will not get the onBeaconServiceConnect callback.

If using Eclipse, check your project.properties file and make sure it has the line: manifestmerger.enabled=true.

If this does not solve your problem, please post the code that binds to the BeaconService and let us know the IDE you are using.

Yordan answered 30/8, 2014 at 11:59 Comment(1)
Yup you're right, just solved the problem by adding services declaration to manifest. I'm using Intelij IDEA don't know how to do automatic merging there. However adding following helps: <service android:enabled="true" android:exported="true" android:isolatedProcess="false" android:label="beacon" android:name="org.altbeacon.beacon.service.BeaconService"> </service> <service android:enabled="true" android:name="org.altbeacon.beacon.BeaconIntentProcessor"> </service>Winters

© 2022 - 2024 — McMap. All rights reserved.