I am developing a Cordova 3.0.0 application which needs to periodically show notifications to the user. They need to be the kind of notifications that live in the notification center on iOS; modal popups aren't good enough as the app may be running in the background at the time.
The built-in Notification plugin only provides modal popups: http://docs.phonegap.com/en/3.0.0/cordova_notification_notification.md.html
I have seen 3rd party plugins, such as this: https://github.com/DrewDahlman/Phonegap-LocalNotification
- however, they are developed for much older versions of Cordova/PhoneGap.
Is it possible to use any of these with Cordova 3; or is there a better way to do it (device-independently if at all possible, as I need to have similar behaviour on Android as well as iOS); or would my best option be to downgrade to an older version of Cordova?
Thanks
Drew Dalhman's Plugin still has some Issues. For example cancel() and background callback do not work.
This one, from Sebastián Katzer is updated and works with Cordova 3+ :
https://github.com/katzer/cordova-plugin-local-notifications
for iOS, Android and WP8
According to the issues for Drew Dalhman's plugin some people have had some success using that plugin in Cordova 3.0.6:
https://github.com/DrewDahlman/Phonegap-LocalNotification/issues/18
Rather than downgrading to an earlier version I'd look to see if a pull request can be created for the plugin. This will help everyone and will allow you to take advantage of Cordova improvements.
I was actually researching this same issue earlier for Android. Not implemented anything yet, but this tutorial seems to have some useful information (Part 3 is most relevant to showing notifications):
http://red-folder.blogspot.co.uk/2012/09/phonegap-service-tutorial-part-1.html
I googled but couldn't find anything.
My suggestion would be that you write your own plugins/extensions for Android and IOS respectively. It isn't difficult. The problem with writing your own IOS plugin is that you need to have a mac and iphone/ipad. Also, try the Phonegap-LocalNotification plugin you mention, it could possibly work.
Related
I swear I have thoroughly searched.
Ionic, (btw, only Capacitor works for ios, and only Cordova for android, -just cordova, or just capacitor won't work for both-, and... some cordova is still needed for ios-capacitor to work, but I was able to make all work nice, and publish in both stores, and working on both devices, though issues may happen depending on the plugins you need... feel free to comment).
Then I added chart.js, and in Android, it´s all ok on device, but when testing on an ios device, charts are blank.
No chart.js code sample needed here, as the code is just the same you can find in a simple google search, it may as well just be copy-paste and works fine as just mentioned.
As close as I've come is to figure it may have something to do with the canvas tag, I simply use
<canvas #someCanvas></canvas>
but it may be needed to add some other properties to this tag, for it to work on ios device.
Any help/thoughts, please? Thanks :)
Chart.js dropped support for older browsers so you might have to pollyfill the resize observer and maby some features.
Source: https://github.com/chartjs/Chart.js/issues/8414
We are using Cordova 5.0.0 and its cordova-camera-plugin
When we are testing it on Android, the app crashes when the user takes a photo.
Looking at the links below, it seems that our app is being killed while the camera app it on front.
PhoneGap camera restarts the application
https://github.com/shaithana/cordova-plugin-wezka-nativecamera
While there are some answers but it seems to be outdated: The foreground camera plugin is not suitable to newer devices or Cordova and other solutions didn't work for us
Does anyone have an up-to-date solution?
Try to use this forked cordova-android and cordova-plugin-camera.
The docs, sample and discussion on the approach used can be found in the cordova-android PR.
BTW, the PRs are going to be merged soon.
First question that comes to my mind is: Why using this camera plugin: https://github.com/shaithana/cordova-plugin-wezka-nativecamera
It's obviously a fork. You might have a good reason for that. It's also outdated. Last contribution was one year ago.
Maybe you want to give the "official" plugin a shot:
https://github.com/apache/cordova-plugin-camera
Going deeper into detail without knowing more about your testing environment (which device(s) with which Android version) and without having possibility to review entire related code, is not possible and answers may not give any reliable advice for change.
Have you ensured, that the call to the camera plugin cannot happen before "deviceready" was triggered? Is cordova.js loaded?
Update:
You may also want to switch from raw alerts to console output. I recognized several times that alerts in callbacks triggered from plugins could cause some trouble.
As a general rule of thumb: Use console.log() instead of alert() and connect with Chrome (chrome://inspect) to the emulator or device to see what happens. You can additionally use adb logcat to have a look into the device log.
I've ran into a problem with apache cordova background modes. I need to make an application where my battery level is checked from time to time in the background (if the app is in background), and if it is below some level, then the app should notify you about it. Eventually I've managed to run it on android, with katzer's plugin, it does work indeed, but after a while it shuts down completely and on iOS it does not even work. I've tried other plugins but nothing was helpful. Can you please help me find the problem with this? Also it must work on wp8/8.1 that's why katzer's plugin suited me best. (Not to misunderstand me, it is an outstanding plugin, in fact the only that works).
Here is the code on Pastebin
Also I'm linking the plugin which I'm using at the moment
Thanks in advance
I'm trying to build an android app by using phonegap.
I need to put a reminder into my app which will notificate the user at any time of the day.
I have tried to intagrate this plug-in; https://github.com/phonegap/phonegap-plugins/tree/master/Android/LocalNotification
But since i use cordova 2.7.0 it does not work on my project.
In this link ( https://stackoverflow.com/a/14307498/2386488 ) Sorcerer has given a way to fix the plug in but i could not apply it well.
Do you have any knowledge about, how can i add an alarm clock like specification into my application?
Thank you!
This one is maintained and works for 2.7, with branches below that.
https://github.com/Wizcorp/phonegap-plugin-localNotifications
That said this one is for IOS only as far as I can tell.
We are enhancing an Android app to have advanced SEARCH features.
The app uses Couchbase-mobile (version 2.0.0) as a an Android service...
I have these questions with implementation:
How simple it is to integrate something like [CouchDB-Lucene][1].
I guess we will have to trigger the couchdb-lucene java process on the Android device (as a service), but not sure if configuring the local Couchbase's .ini file is the only thing needed.
Is CouchDb-Lucene okay for Android or too heavy?
Would be great if anyone could provide some pointers.
Looks like someone got started here: https://github.com/ArtooTrills/TouchDB-Android-Lucene
I should note that this version of the Android syncronizing database is old. We are working on a new lighter version of it, check out the Couchbase mobile mailing list to get the latest info: https://groups.google.com/forum/#!forum/mobile-couchbase