2

I need to run a Kony Javascript function in the background even if the app is killed. It should trigger every 10 minutes. How can I achieve this functionality in Kony?

Mig82
  • 4,856
  • 4
  • 40
  • 63
  • Thanks for your reply. I did background service in native android. I integrated native jar with kony. When I close the Kony app, I am not able to access the kony methods by background service in native android. – Sudarsan Denver Feb 25 '16 at 12:44
  • Seems interesting. I think if you assign a callback function and pass it using FFI, you might be able to call it. OR, while your application goes to background, you call the FFI function and then let the FFI library code handle things from there. – Kushal Ashok Mar 16 '16 at 07:02
  • @SundarsanDenver, please consider answering your own question and sharing the snippets of code relevant to the workaround. Community members are [encouraged to answer their own questions](https://stackoverflow.com/help/self-answer). – Mig82 Feb 14 '19 at 08:55

2 Answers2

1

You can achieve this through a Foreign Feature Interface, or FFI for short. You have to start the service (in Android) in the background and implement your trigger logic there.

Mig82
  • 4,856
  • 4
  • 40
  • 63
Vikram Singh
  • 1,420
  • 14
  • 19
0

I don't think we can run a Kony Javascript function if the app has been killed. You definitely have to do some workaround. For example, create a service that runs even if app has been killed. On app kill, you can restart the service by using the onTaskRemoved listener and then from there invoke the Javascript function.

Mig82
  • 4,856
  • 4
  • 40
  • 63
Samir
  • 46
  • 5