deviceready did not fire within 5000ms - ionic Native with onesignal - ionic-framework

I am using one signal plugin for push notification.
First i installed the one signal plugin.
ionic cordova plugin add onesignal-cordova-plugin
npm install --save #ionic-native/onesignal
Here is my code
this.platform.ready().then(() => {
this.oneSignal.getIds().then((ids)=>{
console.log("USER ID");
console.log(ids.userId);
}).catch((e)=>{
console.log("error")
console.log(e);
})
})
But does not get app id.why?
The error is plugin_not_installed.
I remove this plugin again added.
But still get the same error. and also getting this type of err.
Ionic Native: deviceready did not fire within 5000ms. This can happen when plugins are in an inconsistent state. Try removing plugins from plugins/ and reinstalling them.
Native: deviceready did not fire within 5000ms. This can happen when plugins are in an inconsistent state. Try removing plugins from plugins/ and reinstalling them.
Kindly advice me,
Thanks.

Related

How to Create Custom SplashScreen on Ionic?

I want show custom splash screen with animation. I tried add LottieSplashScreen plugin but i can't do this.
Tried with this code
cordova plugin add cordova-plugin-lottie-splashscreen
But i facing
'sh' is not recognized as an internal or external command,
operable program or batch file.
Failed to install 'cordova-plugin-lottie-splashscreen': Error: Hook failed with error code ENOENT: C:\Users\bbara\Desktop\GuvercinSepetim\plugins\cordova-plugin-lottie-splashscreen\hooks\ios\update_pod_repo.sh
at C:\Users\bbara\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\hooks\HooksRunner.js:224:23
at _rejected (C:\Users\bbara\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:864:24)
at C:\Users\bbara\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:890:30
at Promise.when (C:\Users\bbara\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:1142:31)
at Promise.promise.promiseDispatch (C:\Users\bbara\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:808:41)
at C:\Users\bbara\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:624:44
at runSingle (C:\Users\bbara\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:137:13)
at flush (C:\Users\bbara\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:125:13)
at processTicksAndRejections (internal/process/next_tick.js:74:9)
Hook failed with error code ENOENT: C:\Users\bbara\Desktop\GuvercinSepetim\plugins\cordova-plugin-lottie-splashscreen\hooks\ios\update_pod_repo.sh
You are running a cordova node but not ionic cordova:
cordova plugin add cordova-plugin-lottie-splashscreen
According to ionic documentation:
npm install #ionic-native/lottie-splash-screen
ionic cordova plugin add cordova-plugin-lottie-splashscreen
And here is the referance:
https://ionicframework.com/docs/native/lottie-splash-screen
And here is the github reposatory of the plugin :
https://github.com/timbru31/cordova-plugin-lottie-splashscreen
Try looking into Capacitor instead of Cordova. You can still use all your Cordova libraries, but the Capacitor build is a bit cleaner. I followed this tutorial and found it very useful with good tools. It worked for me first time, which is never the case with some Ionic stuff!
https://enappd.com/blog/icon-splash-in-ionic-react-capacitor-apps/114/
The issue you are describing was fixed in the v0.8.1 release. It originated from preparing/building the iOS platform on a Windows machine - which won't work anyways. Because cordova-ios supports recent Pod installations out of the box, it's no longer required to sync the repo, i.e, the hook is obsolete. However, the lottie plugin won't fail anymore.
Side note: I'm the author of this plugin.

Ionic AppRate fails, incomplete object?

I am trying to add AppRate to my app based on the
https://ionicframework.com/docs/v3/native/app-rate/
example
TypeError: AppRate.preferences.openUrl is not a function. (In
'AppRate.preferences.openUrl(iOSStoreUrl)', 'AppRate.preferences.openUrl' is undefined)
That method is indeed missing on the object when inspected in debugger.
On the plugin documentation they add the method manually.
https://github.com/pushandplay/cordova-plugin-apprate
This approach fails for me however, too. My ionic app has no window object.
I had the same issue, but in ionic 4.
I solved it, firstly, reinstall the plugin from git repository or cordova plugins registry (to make sure we have the function openUrl added) and adding the missing method to #ionic-native/app-rate/ngx/index.d.ts like :
export interface AppRatePreferences {
...
...
...
openUrl?:(url:string) => void;
}
And after where you have used the call of the plugin, you add openUrl: appRate.preferences.openUrl to preferences properties like :
appRate.preferences = {
displayAppName: '',
storeAppURL: {
ios: '<my_app_id>',
android: 'market://details?id=<package_name>',
windows: 'ms-windows-store://pdp/?ProductId=<the apps Store ID>',
blackberry: 'appworld://content/[App Id]/'
},
openUrl: appRate.preferences.openUrl
};
Hope it helps you.
For ionic 3, Make sure the latest versions are installed with support for #ionic-native/app-rate#4
In my case I have solved it by installing version 4 of #ionic-native and version 1.4.0 of apprate.
Try this:
$ ionic cordova plugin rm cordova-plugin-apprate
$ ionic cordova plugin add cordova-plugin-apprate#1.4.0 --save --exact
$ npm install --save #ionic-native/app-rate#4

How can I run an ionic app in a browser having Cordova DatePicker plugin?

common.js:290 Native: tried calling DatePicker.show, but Cordova is not available. Make sure to include cordova.js or run in a device/simulator

Media plugin not installed? Ionic 3

I have an Ionic 3 app that requires to use Media Plugin.
When I press the "record" button on my app, this code block is executed:
this.platform.ready().then(() => {
this.fileName = this.commentsProvider.getFileName(this.platform);
this.filePath = this.commentsProvider.getFilePath(this.platform, this.fileName);
this.audio = this.media.create(this.filePath);
this.audio.startRecord();
this.recording = true;
});
And it doesn't works. The console throws:
console.warn: Native: tried accessing the Media plugin but it's not installed.
NOTE: I'm runing the app in a connected Android device, via USB.
You can see I'm using platform.ready() and anyway I still have this problem.
Any idea?
Thank's in advance!
EDIT: I've already deleted node_modules and plugins folders, and ran npm install, and the problem persists.

cordova add plugin - unable to access

I am trying to add a plugin to Cordova via
cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-device.git
git itself seems to run fine. Running the following works:
git clone "https://git-wip-us.apache.org/repos/asf/cordova-plugin-device.git" "D:\Temp\plugman-tmp1390234462383"
This is what is used in plugins.js line 43 (var cmd = util.format(...)).
The error I receive using the cordova plugin add ... is:
Calling plugman.fetch on plugin "https://git-wip-us.apache.org/repos/asf/cordova-plugin-device.git"
Fetching plugin from "https://git-wip-us.apache.org/repos/asf/cordova-plugin-device.git"...
Fetching plugin via git-clone command: git clone "https://git-wip-us.apache.org/repos/asf/cordova-plugin-device.git" "D:\Temp\plugman-tmp1390235833828"
C:\Users\myUser\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:126
throw e;
^
Error: Fetching plugin failed: Error: Command failed: Cloning into 'D:\Temp\plugman-tmp1390234462383'...
fatal: unable to access 'https://git-wip-us.apache.org/repos/asf/cordova-plugin-device.git/': Failed connect to git-wip-us.apache.org:443; No error
at C:\Users\myUser\AppData\Roaming\npm\node_modules\cordova\src\plugin.js:90:41
at _rejected (C:\Users\myUser\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:808:24)
at C:\Users\myUser\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:834:30
at Promise.when (C:\Users\myUser\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:1079:31)
at Promise.promise.promiseDispatch (C:\Users\myUser\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:752:41)
at C:\Users\myUser\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:574:44
at flush (C:\Users\myUser\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:108:17)
at process._tickCallback (node.js:415:13)
Any idea?
Some more information:
I am going through a proxy, but I set this for git and for npm. I installed Cordova via "npm install cordova" and the project via "cordova create TestApp", I added platforms via "cordova platform add android" and I can run the app on the emulator.
I even tried "phonegap local plugin add https..." with the same result.
All that is missing for me is to add plugins.
Sometimes a Cordova update will cause problems with npm and will corrupt the "cordova cache" that NPM uses to quickly download different Cordova versions. I know there were problems with the server pushing the latest Cordova plugins to NPM, so maybe this is why you're having trouble.
I'd suggest deleting /AppData/Roaming/npm/node_modules/cordova direct in its entirety, than installing a fresh new copy with npm install -g cordova. This shouldn't remove any of your Cordova projects, it will just download a fresh set of the tools. When you run cordova commands, it might take longer the first time since the tools will have to go to the git repo's and fetch the content fresh.
Tried clearing the cordova cache by deleting the folder as suggested by #mbillau but that didn't help. I search for the plugin where I was getting the error and tried installing through command line but got the same error message. Finally the solution that worked for me:
open important files in your IDE
open Cordova plugins
replace all "https://git-wip-us.apache.org/repos/asf/" with "https://git.apache.org/"
and it worked perfectly.
Replace "git-wip-us.apache.org/repos/asf7" with "github.com/apache/"
Like #Max said.
Checking the apache site (either https://git-wip-us.apache.org/repos/asf/, https://gitbox.org/repos/asf/, or https://git.apache.org/) I only see commit logs instead of the sources.
The sources can be found on GitHub. This worked for me:
cordova plugin add https://github.com/apache/cordova-plugin-device.git