cordova-plugin-ibeacon icon indicating copy to clipboard operation
cordova-plugin-ibeacon copied to clipboard

Android 8 IllegalArgumentException: No such service

Open capur16 opened this issue 7 years ago • 30 comments

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

capur16 avatar Feb 16 '18 10:02 capur16

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

sidPuttur avatar Feb 20 '18 14:02 sidPuttur

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?

Powerball18 avatar Mar 20 '18 10:03 Powerball18

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>

vienom avatar Mar 22 '18 09:03 vienom

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

vienom avatar Mar 22 '18 12:03 vienom

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)

BertrandJU avatar Mar 22 '18 16:03 BertrandJU

Anyone knows why this is needed? It wasn't in Android 7.

andersborgabiro avatar Mar 23 '18 14:03 andersborgabiro

@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.

dopry avatar Apr 23 '18 22:04 dopry

Thanks for the info. As the plugin is using beacon library 2.12.4 I guess this should work fine now.

andersborgabiro avatar Apr 24 '18 07:04 andersborgabiro

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.

dopry avatar Apr 24 '18 13:04 dopry

Right at this very now I don't have a phone with Android 8, but when I do I will.

andersborgabiro avatar Apr 24 '18 14:04 andersborgabiro

@vienom's solution worked for me: Google Pixel XL running Android P Beta.

lincolnberryiii avatar May 27 '18 22:05 lincolnberryiii

Seems to be working for me as well. Thanks!

halindrome avatar Jul 23 '18 16:07 halindrome

@halindrome what seems to be working for you? #363 and #364 or manually adding the permissions to your manifest? On which platform?

dopry avatar Jul 23 '18 17:07 dopry

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 avatar Jul 23 '18 18:07 halindrome

@halindrome, which version of cordova-android and the cordova-ibeacon-plugin are you using?

dopry avatar Jul 23 '18 18:07 dopry

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]

halindrome avatar Jul 23 '18 19:07 halindrome

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 .

dopry avatar Jul 23 '18 19:07 dopry

I'll be releasing v3.6.2 to npm soon. Please watch out for that and give it a try.

petermetz avatar Jul 24 '18 23:07 petermetz

Great! Looking forward to that.

andersborgabiro avatar Jul 24 '18 23:07 andersborgabiro

The new release just dropped on npm. Ended up calling it v3.7.0

petermetz avatar Jul 25 '18 00:07 petermetz

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]

halindrome avatar Jul 25 '18 01:07 halindrome

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)

andersborgabiro avatar Jul 25 '18 06:07 andersborgabiro

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.

halindrome avatar Jul 25 '18 11:07 halindrome

@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.

petermetz avatar Jul 25 '18 16:07 petermetz

Great! Thanks.

The custom config is removed.

andersborgabiro avatar Jul 25 '18 18:07 andersborgabiro

@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?

dopry avatar Jul 25 '18 19:07 dopry

Good idea. I'll test that tomorrow.

andersborgabiro avatar Jul 25 '18 20:07 andersborgabiro

No problems so far with uninstalling, but right now done on devices lower than Android 8.

andersborgabiro avatar Jul 26 '18 07:07 andersborgabiro

@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 avatar Jul 30 '18 19:07 halindrome

@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.

petermetz avatar Jul 30 '18 20:07 petermetz