0

I have created an HTML5 application using Cordova. I am using a background mode plugin (https://github.com/katzer/cordova-plugin-background-mode) but still the JavaScript code is not executing if the application is minimized. The same code is working in an older version of Windows 10 (Version 1607 OS build: 14393.2214). But this is not working in the latest Windows build (Version 1803. OS Build: 17134.345).

Please help me to resolve this issue

jineesh MG
  • 61
  • 8

1 Answers1

0

If the code breaks only after minimization, we'll have to see the code to know the reason. Minimization seems to break some part of your logic, but we can't be sure without seeing the code.

Delwyn Pinto
  • 614
  • 1
  • 6
  • 14
  • I have tested this with a simple setInterval function. No complicated logic. For testing purpose I have written some logs to file system from this setInterval method. If the app is not in background the trace log is writing without an issue. – jineesh MG Nov 05 '18 at 12:31
  • Hi @delwyn Pinto, co you have any idea? – jineesh MG Nov 06 '18 at 07:20
  • Its not so much about the logic, but the code you've written. For example, if you are using page names such as 'Dashboard' for a conditional check and it gets converted to '1' when minified , that part of code will break. Check if the code depends on something that might be getting modified in a production release. – Delwyn Pinto Nov 08 '18 at 07:34
  • Thanks for the update. Sorry I dont understand your comment. The code I am using as follows.: ` ` When I minimize the application the logs are not generating. But if the applicaiton is foreground then log is generating. This is happened on latest 1803 Windows 10 version – jineesh MG Nov 09 '18 at 12:39
  • This helps. How are you sending the app to the background ? Can you explain the scenario and post the code snippet ? – Delwyn Pinto Nov 09 '18 at 14:04
  • I have just minimized the app and when I monitor the event log file I can see there is no activity. When I bring the app foreground this will work again. Something like a pause and resume happening in between. For testing purpose I have used the above setInterval code only. – jineesh MG Nov 12 '18 at 06:46
  • Then you aren't enabling background mode at all. From the plugin's documentation **The plugin is not enabled by default. Once it has been enabled the mode becomes active if the app moves to background.** Use the line `cordova.plugins.backgroundMode.enable()` to do so once the app has finished loading. – Delwyn Pinto Nov 14 '18 at 06:00
  • backgroundMod.enable() doesn't work in Windows app. – jineesh MG Dec 31 '19 at 14:32