-
-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
support ionic #1
Comments
By default, you can import "IRoot" class from "cordova-plugin-iroot\www\iroot". Thus, I have conditionaly added this file in index.html (which is only if device is mobile type). I have customized my IRoot.js file to be as below -
Now to call
Now, to call required functions -
This works in web as well as in mobile app. I haven't tested yet in web-browser of a mobile device. There may be better way(s) of doing this, which we will be happy to know about. |
Thank you @sujit77 , I check it |
@sujit77 I fixed in ionic. I need some tests with normal apps. lastChanges@progress |
@WuglyakBolgoink, have you found better way of importing this plugin into Angular(2 and above) projects? I can test it out too if you can instruct me for that. You can test it in Android studio using android emulator. However, I haven't tested it in iOS device cause it is hard to find jail broken iPhone. |
FYI @sujit77
ionic cordova plugin add cordova-plugin-iroot --save
declare var IRoot: IRoot; with import { IRoot } from '../../plugins/cordova-plugin-iroot/iroot';
import { Component } from '@angular/core';
import { Platform } from 'ionic-angular';
import { StatusBar } from '@ionic-native/status-bar';
import { SplashScreen } from '@ionic-native/splash-screen';
import { TabsPage } from '../pages/tabs/tabs';
import { IRoot } from '../../plugins/cordova-plugin-iroot/iroot';
declare var IRoot: IRoot;
@Component({
templateUrl: 'app.html'
})
export class MyApp {
rootPage: any = TabsPage;
constructor(platform: Platform, statusBar: StatusBar, splashScreen: SplashScreen) {
platform
.ready()
.then(() => {
// Okay, so the platform is ready and our plugins are available.
// Here you can do any higher level native things you might need.
statusBar.styleDefault();
splashScreen.hide();
console.log('platform', platform);
if (platform.is('cordova')) {
console.log('is cordova');
try {
console.log(' IRoot', IRoot);
IRoot.isRooted((booleanVal) => {
console.log('IRoot.isRooted success: ', booleanVal);
}, (err) => {
console.log('IRoot.isRooted error:', err);
});
}
catch (e) {
console.log('Error:', e);
}
} else {
console.log('is not cordova');
}
});
}
} and build app
Test-1:
Test-2:
Test-3: (todo)
Test-4: (todo)
|
Hi @mrpower55 & @sujit77 please check if all work with 0.6.1 version |
I am not able to make it work. Will you be able to help me in detecting steps which I have missed? I have installed latest package using -
Trying to import
The one which works is -
But above one generates error while running -
This is exactly same what I got earlier with version |
do not import IRoot as cordova plugin. IRoot Plugin is available as You can import |
@WuglyakBolgoink , new changes works perfectly with pitfalls. Installed using -
I started getting following errors while building package files for specific mobile platforms -
But, finally it worked(I just hibernated system). |
@WuglyakBolgoink we just need to remove the |
@sujit77 ok. I will check this. |
Hi @WuglyakBolgoink, While I am using the plugin. I am facing the issue of Thank you |
@CHENPINGFIONA see my comment above. if this do not help you, then how can I reproduce your case? |
@WuglyakBolgoink |
@CHENPINGFIONA can you create a demo repo with your test project to reproduce this error? |
@WuglyakBolgoink |
The steps above to compile no longer work
|
So basically everything worked fine when I removed "import { IRoot } from '../../plugins/cordova-plugin-iroot/iroot';" line from the app.component.ts and changed the line "declare var IRoot: IRoot;" to "declare var IRoot;". Try this and everything works (for people who are trying to directly copy paste the code and getting errors) Thanks @WuglyakBolgoink for the perfect code ! |
Hi @WuglyakBolgoink |
@AditioPutra but can you find this file manually? |
no i can't find it |
@AditioPutra reinstall plugin and check folder: |
@WuglyakBolgoink I tried doing types import in version 0.8.0 but did not work on version 0.6.1 import { IRoot } from '../../../plugins/cordova-plugin-iroot/iroot'; works |
This is working. Thanks, bro |
hi there, i want to add this plugin on my ionic project
but i can't know what is the class of it to set it on providers,
also i can't know what is the function i need to use on ionic
so please help me
thanks
The text was updated successfully, but these errors were encountered: