I have tested this on a real device and in the browser (although I know it won’t work in the browser). In the browser it says that notification is not defined.
That’s because most cordova plugins don’t work in a browser environment. For those that do, you must add the “browser” cordova platform and build for it. Ordinary ionic serve won’t do. If the ionic-native shim doesn’t have some sort of functionality that the underlying plugin does, how about considering submitting a PR to add it? @ihadeed is quite receptive to community contributions.
I see, I’m not worried about it working in the browser anyway but I would like to get it working on my device. I want to test the local notifications and see if it does indeed have the functionality I desire if so then I would look into creating the pull request.
My issue now is that I cannot get the plugin to work with ionic. It does not seem to be finding the plugin.
I was initially using ionic-native and it doesn’t seem to have an option for priority which allows the notification to show as a heads up notification on android and it doesn’t seem to wake the device to display the notification. It was suggested on the github issues of the local notification plugin that it was possibly something ionic did to prevent it from waking the device. So that is why I am now trying to get the cordova plugin working. Apologies if this is confusing.
I would be surprised if you saw any difference in that sort of behavior whether using ionic-native or not. If there is an issue, I think it would have to be with Ionic itself, because as you can see in here, there is nothing that looks remotely like it would affect that sort of thing.
This did not solve the notification not triggering while the device is locked and the screen is dimmed but if I find a solution I will post back here for anyone who stumbles across this.
EDIT: It seems this has possibly fixed the issue of the notification not occurring when the device is locked.
There is, Katzer, the owner of the plugin has stated this update a short time ago: UPDATE (22.05.2017) I've released v0.8.5 with contains the code from ios10 branch as it is. I will start working on a new major version while dropping support for older SDKs. I will try to include all you PRs.
So it may take a while but should be merged at some point.
Thanks, yes it seems priority is missing and setting a priority to high is what allows the notification to be a heads up notification (for Android at least, I’ve read iOS has it by default but haven’t been able to check) which can be misleading.
I was about to open an issue on github about this, there is more functionality missing.
I want to use ‘actions’ inside these notifications, an action would be like an reply button when its an notification about an email or even typing an reply inside the notification (as in Android 7). @ihadeed can you add that to your issue?