How to install a cordova plugin?

Hi, I know it may seem like a very stupid question, but once I install a cordova plugin, how do I import it into my Ionic project?
For example: I installed this plugin https://www.npmjs.com/package/cordova.plugins.unlocksdetector, how can I use it in my home.ts?

Thanks and best regards.

It’s far from a stupid question, but I’m not convinced you picked a worthwhile plugin to ask it about. Actual jailbreak detection is theoretically impossible, because the jailbroken device can present whatever face it wishes to your app. So the best you or any plugin author can do is half-assed pseudo-detection that I don’t see any point in bothering with.

However, if you insist, I would expect you could just follow the instructions in the plugin README, because (another strike against it) the plugin pollutes your global namespace with an unlocksDetector object.

I have put an example of a plugin, if any, what example of code would you use to import that plugin into Ionic? I have asked for several forums and they have told me “like the other plugins” but it has nothing to do with the native plugins that I know of.

And I’m doing everything I can to try to convince you to forget all about that particular plugin.

True, which is another indicator that it’s probably not worth bothering with.

As I said before, follow the README in the plugin documentation. There is nothing to import. The plugin uses atavistic deployment techniques: it does not respect namespaces or provide anything to import. It simply injects an object into the global namespace. To placate TypeScript concerns about it, you can declare var unlocksDetector.

Okay, thanks. :wink: