Skip to content

Capacitor Run #594

@alicarlo

Description

@alicarlo

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions