cordova-plugin-ibeacon
cordova-plugin-ibeacon copied to clipboard
Android 8 IllegalArgumentException: No such service
Hi running this plugin on a oneplus 3t with android 8.0 I receive the following error: java.lang.IllegalArgumentException: No such service ComponentInfo{com.example.myproject/org.altbeacon.beacon.service.ScanJob}
To make it work I had to add the following lines to the AndroidManifest.xml:
<service android:permission="android.permission.BIND_JOB_SERVICE" android:name="org.altbeacon.beacon.service.ScanJob"> </service>
and
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
Please you could fix this thanks
Hi., Even i have a crashing issue in android 8 and no logs printed. Can you please explain what is BIND_JOB_SERVICE and org.altbeacon.beacon.service.ScanJob? . Is this specific to your use case?
Thanks
This didn't fix it for me. I'm using Ionic 3.0 and added it to the config like this.
<config-file parent="/manifest" target="AndroidManifest.xml"> <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> <service android:name="org.altbeacon.beacon.service.ScanJob" android:permission="android.permission.BIND_JOB_SERVICE"> </service> </config-file>
any other ideas?
The target of a service is the application, the target of the uses-permission is the manifest. Try it like this:
<edit-config file="AndroidManifest.xml" mode="add" target="/manifest/application"> <service android:name="org.altbeacon.beacon.service.ScanJob" android:permission="android.permission.BIND_JOB_SERVICE" /> </edit-config> <edit-config file="AndroidManifest.xml" mode="add" target="/manifest"> <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> </edit-config>
Actually its better to change the permissions in the plugin.xml. Faced some issues with the above solution. Here is a fork where you can see the changes: https://github.com/vienom/cordova-plugin-ibeacon
Works well in config.xml with plugin "cordova-custom-config":
<platform name="android">
<allow-intent href="market:*" />
<!-- FIX ANDROID 8 see: https://github.com/petermetz/cordova-plugin-ibeacon/issues/350 -->
<custom-config-file parent="/*" target="AndroidManifest.xml">
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
</custom-config-file>
<custom-config-file parent="./application" target="AndroidManifest.xml">
<service android:name="org.altbeacon.beacon.service.ScanJob" android:permission="android.permission.BIND_JOB_SERVICE" />
</custom-config-file>
</platform>
(Permission RECEIVE_BOOT_COMPLETED is not required)
Anyone knows why this is needed? It wasn't in Android 7.
@andersborgabiro the beacon handling and background tasks in Android 8 changed. http://www.davidgyoungtech.com/2017/08/07/beacon-detection-with-android-8 covers some of it. You can dig up some more details starting at https://developer.android.com/about/versions/oreo/android-8.0-migration.html look into the Bluetooth and background changes.
Thanks for the info. As the plugin is using beacon library 2.12.4 I guess this should work fine now.
There are still permission and dependency issues that effect Android 8. If you have time to test #363 and #364 could use additional testing and review.
Right at this very now I don't have a phone with Android 8, but when I do I will.
@vienom's solution worked for me: Google Pixel XL running Android P Beta.
Seems to be working for me as well. Thanks!
@halindrome what seems to be working for you? #363 and #364 or manually adding the permissions to your manifest? On which platform?
Manually adding the permissions (through custom-config on cordova)
On Mon, Jul 23, 2018 at 12:57 PM dopry [email protected] wrote:
@halindrome https://github.com/halindrome what seems to be working for you? #363 https://github.com/petermetz/cordova-plugin-ibeacon/pull/363 and #364 https://github.com/petermetz/cordova-plugin-ibeacon/pull/364 or manually adding the permissions to your manifest? On which platform?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/petermetz/cordova-plugin-ibeacon/issues/350#issuecomment-407146480, or mute the thread https://github.com/notifications/unsubscribe-auth/AAfx8Ht15zpYq4klbtMZ3GMGt-Q5_NReks5uJg6LgaJpZM4SIILz .
-- Shane McCarron [email protected]
@halindrome, which version of cordova-android and the cordova-ibeacon-plugin are you using?
cordova-android is 6.4.0 I think. cordova-plugin-ibeacon is at 3.6.1 I think.
On Mon, Jul 23, 2018 at 1:58 PM dopry [email protected] wrote:
@halindrome https://github.com/halindrome, which version of cordova-android and the cordova-ibeacon-plugin are you using?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/petermetz/cordova-plugin-ibeacon/issues/350#issuecomment-407165178, or mute the thread https://github.com/notifications/unsubscribe-auth/AAfx8DMbcjJUYMZfRaa9ePAXAQM8uY7nks5uJhzygaJpZM4SIILz .
-- Shane McCarron [email protected]
Can you try with the latest 3.x version of the plugin directly from github and see if the permissions are still required?
On Mon, Jul 23, 2018, 3:10 PM Shane McCarron [email protected] wrote:
cordova-android is 6.4.0 I think. cordova-plugin-ibeacon is at 3.6.1 I think.
On Mon, Jul 23, 2018 at 1:58 PM dopry [email protected] wrote:
@halindrome https://github.com/halindrome, which version of cordova-android and the cordova-ibeacon-plugin are you using?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub < https://github.com/petermetz/cordova-plugin-ibeacon/issues/350#issuecomment-407165178 , or mute the thread < https://github.com/notifications/unsubscribe-auth/AAfx8DMbcjJUYMZfRaa9ePAXAQM8uY7nks5uJhzygaJpZM4SIILz
.
-- Shane McCarron [email protected]
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/petermetz/cordova-plugin-ibeacon/issues/350#issuecomment-407168482, or mute the thread https://github.com/notifications/unsubscribe-auth/AAXqOPAYvjW4-EC6syJIdkSceG8blI4dks5uJh-lgaJpZM4SIILz .
I'll be releasing v3.6.2 to npm soon. Please watch out for that and give it a try.
Great! Looking forward to that.
The new release just dropped on npm. Ended up calling it v3.7.0
I will do some testing with it in the AM.
On Tue, Jul 24, 2018 at 7:41 PM Peter Metz [email protected] wrote:
The new release just dropped on npm. Ended up calling it v3.7.0
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/petermetz/cordova-plugin-ibeacon/issues/350#issuecomment-407596060, or mute the thread https://github.com/notifications/unsubscribe-auth/AAfx8FB_qspYIQCKgy3IClQxVW8ipgOfks5uJ767gaJpZM4SIILz .
-- Shane McCarron [email protected]
Works fine on Android 6 and 7 and iOS 11.4.1.
So, is the Android 8 specific configuration not needed anymore? Anything else that's changed? (there's no release note, so I couldn't check there)
Started testing now - I have been pulling these straight from github instead of npm for a variety of reasons. There is no tag for 3.7.0 FWIW.
@andersborgabiro @halindrome Forgot to create the tag/release on GitHub yesterday, but here it is now: https://github.com/petermetz/cordova-plugin-ibeacon/releases/tag/3.7.0
For future reference: the CHANGELOG file always contains the release notes as well.
Great! Thanks.
The custom config is removed.
@andersborgabiro, so everything is building and working for you? Did you also do a complete uninstall on your development device to ensure there aren't any permissions hanging around from an earlier update?
Good idea. I'll test that tomorrow.
No problems so far with uninstalling, but right now done on devices lower than Android 8.
@petermetz thanks for adding the tag. I note that it does not follow your usual pattern of starting with a 'v' however. Might confuse some people.
@halindrome Yes! Thank you for pointing that out! We need more automation to eliminate these silly mistakes. Created a new tag, this time with the right name.