i'm working on an app that sends push notifications to users... nothing special about that.
Special is, that my client wishes that the push notifications will be sent to the lock screen, and not only to the status bar.
I know it's a feature of Lollipop 5.0, but I have a friend with an old 4.2 Android and he receives the push notifications from the app to the lock screen somehow.
I heard it could have something to do with the androidManifest.xml file with notifications permissions and Android's window manager, but I haven't found nothing on it.
I'll appreciate any assistance or words of advice regarding it, maybe there's a way for Cordova to enable it, or maybe I don't understand Android developing well enough...
Much thanks for any help!
I have a friend with an old 4.2 Android and he receives the push notifications from the app to the lock screen somehow
Either he has a custom ROM installed that offers lockscreen notifications, or the device manufacturer itself implemented some equivalent of lockscreen notifications. There is no means for you, as an app developer, to put notifications on the lockscreen prior to Android 5.0.
You can implement a lockscreen app widget (in Java, probably not via Cordova) and display information that way, and that will work on 4.2 through 4.4.
Related
I have developed a chat App in Android using Firebase which has the concept of blocking push notification when my device is in lock condition. For this feature, I required to implement Foreground service because as soon as the user unlocks his device, the device receives the blocked notifications or all the blocked chat messages.
Now, I want to develop the iOS version of this App using the same Firebase but I'm not sure if I can hold the notification like the Android if my iOS device is in lock condition (with App not running in the background). So, is this feature is feasible in iOS and if yes then how I can achieve this ?
Thanks in advance
From my research, you used to be able to register for a specific Darwin notification, com.apple.springboard.lockstate . However, Apple is rejecting apps for this practice as the API is not public.
If you could explain why you’re attempting to catch notifications while the device is locked.
A thought: perhaps a silent push could be of benefit.
I successfully implemented the Firebase Unity SDK for notifications (sent by a cloud function). My understanding of notifications is that it should not end up in the notification tray at all if the app is open and takes it (it has data and notification portion), however in fact all notifications pile up in the tray. I managed to provide a CollapseKey and according message tag to at least have just the latest one show up there, however as long as the app is in the foreground (also when device goes to sleep) there is actually no point in notifying via tray.
So what I would like to do is to actively remove any notification on app start or recovery from pausing/sleeping. Is that somehow possible? I haven't found any API within the Unity SDK.
Thanks, habitoti
It looks like this is an issue on Android proper as well, and there's already a good Stack Overflow post on it. If you're unable or uncomfortable with writing a native Android plugin (I actually create an Android messaging plugin in this article as an example), I think I have a pure Unity solution.
First, you will need to pull in the Mobile Notifications package (the documentation is for a preview, but it looks like 1.0.3 is stable).
Then you should be able to call CancellAllNotifications as listed here. It's a static function, so all the code you should need is:
AndroidNotificationCenter.CancellAllNotifications();
LMK if that works for you!
--Patrick
As far as I googled if an app is in background notifications drop in a tray and can't be shown as heads-up overlaying all other apps. But yet instagram notifications overlay other apps even when instagram not in the foreground. How do they do this? I managed to show heads-up notification on emulator but only when my app is in the foreground and couldn't do the same on my real device (Huawei). Android on device and emulator are the same - 5.1
Can it be connected with a source of notifications? I am using firebase console to send notifications. Probably it's firebase restriction and I should switch to onesignal or another provider?
Also, are heads-up notification can only be singleline, or I can somehow enable multiline mode?
Please, give me working code for heads-up notifications when app is in the background. I already tested everything I could find on StackOverflow on the matter.
That might be the case of OS force closing background services. Some manufacturers like Huawei, Xiaomi etc, do that intentionally to enhance battery life. But for apps like Instagram and Whatsapp, manufacturers whitelist these apps.
To whitelist any App you have to change settings from the device itself.
To change settings for your app here is the link.
I have an app that I'd like to send push notifications to. But I understand that if I've shut down the application (especially on iOS at least until iOS 7) that push notifications won't launch it (either in the background or the foreground).
I understand the PushKit framework has been added to iOS 8+, and that one of the things it can do is cause an application to launch in the background (and I presume handle my push notification).
Is there a way to trigger this functionality in FireMonkey? Does the same sort of functionality exist for Android as well?
I have implemented a push notifications plugin for PhoneGap Build, waited for it for so long
https://build.phonegap.com/blog/introducing-genericpush-plugin
However I'm having issues with the Android app not running in the background. Push notifications are not received when I close the app. Everything is fine when the app is running. Has anyone tried it with Android? Are there any fixes that need to be done?
Thanks!
It's not something related to the GenericPush plugin itself.
It's something related to the way Android manages apps. If your user manually closes the app, it means that he doesn't want to receive messages anymore. This is why even the GCM BroadcastReceiver is stopped and the device doesn't receive the notifications.
Here's some useful links:
Android GCM google groups
Similar question, related only to Android (native)