3

Sorry for the general question but I'm stuck. There are a lot of functions documented on developer.android.com and if I were to use anything from that website in a JAVA android project I would just add the dependency and start coding. But how does it work when I use Ionic instead? Or should the question be what if I use Cordova instead? Not even sure about how to ask the right question. For example I want to use the WorkManager: https://developer.android.com/topic/libraries/architecture/workmanager

How do I do that in an Ionic project? I tried to google "ionic workmanager" but I find no documentation. Which surprises me because ionic is an essential framework and the workmanager is an essential component of android.

Robert
  • 432
  • 1
  • 4
  • 15

1 Answers1

2

Usually with a Cordova (Ionic) application you do not work with native interfaces directly. Instead you would add a plugin to your project that provides a JavaScript interface to a native feature. Most of the time these plugins will be cross platform and implement the same feature for each platform with different native interfaces but the same JavaScript interface for your Cordova code.

For your example, if you're trying to run some background tasks or schedule something, maybe the links in this answer will help. It looks like there are some challenges with running Cordova in the background.

Otherwise, if you really want to write Android code in a Cordova project, you'll need to get familiar with writing Cordova Plugins and maybe write a bespoke plugin for this project.

markdon
  • 784
  • 8
  • 19
  • 1
    I have learned how to write custom cordova plugins which makes it possible to access everything from developer.android.com :) – Robert Mar 15 '20 at 16:49