So I'm using this plugin (https://github.com/katzer/cordova-plugin-local-notifications) for my app to have local notifications however it is not working when I have tested it.
I followed this tutorial https://devdactic.com/local-notifications-ionic/
I have tested the app on Ionic View on both android and iOS. I press the buttons but nothing shows up.
I have tried switching $cordovaLocalNotification with cordova.plugins.notification.local. when trying to use the functions in the plugin but that didn't work.
For what it's worth, the plugin does not show up in the package.json file but it does show up when I run the 'cordova plugins' command.
EDIT 1: The following is an image taken from my iPhone after I clicked Add notification
In my $ionicPlatform.ready(function(){...}), I have the following code
if(window.cordova && window.cordova.plugins.notification) {
alert('This alert doesn't fire');
}
The alert doesn't appear which means window.cordova.plugins.notification is unavailable just like the picture indicates
EDIT 2: On the ionic forums it was suggested that the plugin is not working on the Ionic View app as it is not one of the supported plugins. Please refer to: https://forum.ionicframework.com/t/katzers-local-notification-plugin/86748
However it does work when running/testing on a device(android) instead of the Ionic View app.
Add --save at the end of your command, something like:
cordova plugin add de.appplant.cordova.plugin.local-notification --save
It will add it to your config file.
Edit: Maybe you have error while using it. See error log by running the app with following command:
ionic run android -l -c
Finally running in the real device solved the issue.
Related
Use vscode to compile flutter app with webview on mac,run it in ios simulator,it's normal,
and I have added "io.flutter.embedded_views_previewYES" in ios's Info.plist,I am sure I have installed "webview_flutter" plugin,
but when I run it in xcode,always appears "Module webview_flutter_wkwebview" not found,
till now,I cound not solve the problem,please help,thanks!
https://github.com/fluttercommunity/flutter_webview_plugin/issues/657
I managed to make it work by opening Runner.xcworkspace instead of Runner.xcodeproj
I created new default tab project . I changed nothing. run the ionic serve no errors app opened in beowser its empty nothing.
After long investgation i found it opens the index.html inside src.
what happend why it is not lunching the real app.
I have ionic 5
It was a chrom problem. I had old version I upgrade it works fine. Looks old chrom dont understand type="model" for that it was nit downloading the js file
I am trying to display image selected from camera/gallery using cordova-plugin-camera plugin and used window.Ionic.WebView.convertFileSrc() for Rewriting file:// due to wkwebview.
It works fine in android platform but in iOS platform it gives error for Content Security Policy
For example I am getting
file:///Users/CN339/Library/Developer/CoreSimulator/Devices/XXXXXXX/data/Containers/Data/Application/XXXXX/Library/NoCloud/cdv_photo_002.jpg
from camera plugin and after using window.Ionic.WebView.convertFileSrc on previous local url I am getting below error.
Content Security Policy error
I tried a lot of methods to load local files such images or videos. I tried using
normalizeUrl (from ionic-angular)
regex and replace the local file path: path.replace(/^file:///, '')
window.Ionic.WebView.convertFileSrc()
None of above worked for me. The only way I could load a local file was using
window['Ionic']['WebView'].convertFileSrc(path);
Hope it works as you want. I have only tested it on Android
UPDATE
You can use win.Ionic.WebView.convertFileSrc(), like third bullet, only if you declare win: any = window.
To define win as any did the trick for me - https://stackoverflow.com/a/55934321/10243902
Just had the same problem on iOS after ionic-webview suddenly stopped working, so I uninstalled and reinstalled the plugin:
cordova plugin remove cordova-plugin-ionic-webview
cordova plugin add cordova-plugin-ionic-webview
window.Ionic.WebView.convertFileSrc started working like a charm again.
this.tempSchemeImagePath = window['Ionic']['WebView'].convertFileSrc(nativeURL);
For my ionic app, I am trying to update the energized colour to the following:
$energized: #FFC0A9 !default;
I updated ionic.app.scss in the /scss directory and restarted the app using ionic serve. However the colour hasn't been updated. What am I missing?
If you are using sass (http://ionicframework.com/docs/cli/sass.html), did you execute "$gulp sass" before running the application?
As per the Ionic Guide Chapter 4 http://ionicframework.com/docs/guide/testing.html, ionic serve will start a live reload server, which it does in my case, but reload is not happening.
Is there any pre-req we need to have for this thing to work? Like say live reload chrome extension?
E:\Ionic\myapp>ionic serve
Running dev server: http://localhost:8100
Running live reload server: http://localhost:35729
Here is what worked for me:
stop ionic service if you running it 'q' command
run: ionic address from command prompt
After running this command it will prompt you to select what address you would like to use one is localhost and the second one is your machine IP address.
Try to use select your machine IP address instead of localhost.
Even I faced similar issue, console used to display the file changed but automatic browser refresh wasn't happening. Later I found out a missing closing tag in my index.html page that prevented ionic to inject the below script required for live reload.
<script src="//localhost:35729/livereload.js?snipver=1"></script>
Please check for any typo errors or other html issues in the index.html page and fix those. Live reload should word properly after that.
In Ionic 2/3, I solved this problem by removing the folder node_modules/ and file package-lock.json, then at terminal run:
npm install --save
I'm my case, I was bootstraping the app with this:
window.ionic.Platform.ready(function() {
angular.bootstrap(document, ['myApp']);
});
Then I changed it for this:
<body ng-app="myApp" >
<ion-nav-view></ion-nav-view>
</body>
And it works
if you want to get Live console logs in the ionic application (real
device or emulator)
ionic cordova run android --livereload --consolelogs --serverlogs