How to check device is rooted or not in ionic 2 typescript

I am developing a mobile app using ionic2. I need to check if android device is rooted. I did google and found the this plugin cordova-plugin-root-detection but it does not work for me.

I added this plugin in my project using following command as explain in above link

cordova plugin add

after adding this plugin i tried to import it but it does not import, saying no module present. I did force quit my project and ran npm insatll and opened my project again but error still present.

rootDetection.isDeviceRooted(successCallback, errorCallback);
Calling this does not work as module is not present.

Any reference of plugin or any suggestion will be helpful.

That plugin is not one of the Ionic Native set, so there is no module to import. You would access its methods in a more traditional JS manner rather than the Ionic wrapper style used by Ionic Native.

Also, you will need to test your code on an actual device or maybe the Android emulator.

If you’re going to offer to add additional functionality when run on rooted devices, carry on. If you’re trying to deny functionality or refuse to run on rooted devices, I think this is a fool’s errand, because a rooted device owner should be able to spoof this plugin into ignorance.