Software Archive
Read-only legacy content
17061 Discussions

Background Mode Plugin Katzer

Hamilton_Tenório_da_
Valued Contributor I
1,116 Views

I am trying to keep a APP running in background. I found this plugin: https://github.com/katzer/cordova-plugin-background-mode

I inserted the .js file on index.html after cordova.js: <script type="application/javascript" src="js/background-mode.js"></script> 

When I use the emulator XDK, there is an error: ReferenceError: require is not defined

Looking inside the .js file, there ares these lines:

var exec    = require('cordova/exec'),
    channel = require('cordova/channel');

How I can supply these complements? There is another way to do that?

Thank you.

0 Kudos
6 Replies
Hamilton_Tenório_da_
Valued Contributor I
1,116 Views

I found the solution... the "Third-Part Plugins" of XDK!!!

I just imported the plugin and it works.

Great.

0 Kudos
Arua_C_
Beginner
1,116 Views

Did you like that plugin? Would you recommend it?

0 Kudos
Hamilton_Tenório_da_
Valued Contributor I
1,116 Views

@Arua> Yes, I use this plugin. In general, it works OK. In some cases, when it is working, it loses the function. In this case, the app don´t return. It is necessary to kiil the app to reopen. You can see it working in "Speak to WhatsApp" (https://play.google.com/store/apps/details?id=com.hamiltonhtsnet.com.br.faleparaowhatsapp2) or "Speak do Chat" (https://play.google.com/store/apps/details?id=com.hamiltonhtsnet.com.br.faleparabatepapoplus).

0 Kudos
FACUNDO_R_
Beginner
1,116 Views

HI HAMILTON, HOW YOU USE THE PLUGIN, BECAUSE I CAN USE!!!

THANKS!!

0 Kudos
Hamilton_Tenório_da_
Valued Contributor I
1,116 Views

@Facundo> I just inserted a third-party plugin (de.appplant.cordova.plugin.background-mode) and control it inside the script.

In my case, I have an option to user define if he/she wants the background mode.

Did you see my apps? Try them to see the plugin working.

0 Kudos
Alfredo_U_
Beginner
1,116 Views

I could not install with the "Third Party Plugin", it sends me errors everytime

0 Kudos
Reply