Issue
When the app is launched the first-time, this is working, after that remove the app from a session, then launch the app, it says
IRoot is not defined
declare var IRoot: any;
ngOnInit() {
this._platform.ready().then(() => {
if (typeof (IRoot) !== 'undefined' && IRoot) {
IRoot.isRooted((data) => {
if (data && data == 1) {
this.isRootedORJailBreak = true
console.log("*******This is routed device");
} else {
this.isRootedORJailBreak = false
console.log("*******This is not routed device");
}
}, (data) => {
this.isRootedORJailBreak = false
console.log("*******routed device detection failed case", data);
});
});
} }
Solution
It seems that the plugin isn't ready when cordova is ready, or isn't doing the registration at time.
You can try to wrap up your code inside of the plataform.ready()
with a setTimeout(() => { // your code }, 500);
and see if that works.
I saw your issue in github and the response that they gave you, but is just the same that you have tried here.
UPDATE
Move the code inside of the this._platform.ready().then(() => {})
block to the ionViewDidEnter
hook, the problem with the ngOnInit
is that it can be cached and only will be called one time, the ionViewDidEnter
will be called always, no matters if the component has been initialized before.
It seems that the problem was an issue with the cache.
Answered By - dlcardozo
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.