Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Capacitor Run #594

Open
alicarlo opened this issue Apr 25, 2024 · 0 comments
Open

Capacitor Run #594

alicarlo opened this issue Apr 25, 2024 · 0 comments

Comments

@alicarlo
Copy link

I hope the information is useful to you.

I have used this plugin in Córdoba without problems, this time I use it in a capacitor, I will attach the steps to make it run

npm i cordova-plugin-background-mode --force
npm install cordova-plugin-background-mode@github:Mforcen/cordova-plugin-background-mode#2b9a4de --force

npm i cordova-plugin-device --force
ionic cordova plugin add cordova-plugin-device

CAP1

You must manage the permissions yourself, you can use a plugin like android permissions or guide the user to the configuration to enable them, normally this plugin is used to obtain the gps in the background, the gps will only ask for permissions to use with the app in foreground, but by adding the following permissions in your android manifest, you will be able to see the allow all time permission on your location

Allow all the time

image

Permissions on your android manifest

image

The permission must be added to disable battery saving for the background mode to work, when adding the permission the application will automatically request it

At this point the previous steps should work in cordova as well, in capacitor it generates an error in getView() when reopening the app

image

A temporary solution is to modify a line in the plugin. I attach the commit link.

0bc885c.

image

With the previous notes you should be able to run the background, v5 capacitor is being used, the tests were done with Android 10 and Android 13

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant