I have an iOS app with notifications working using the necessary delegates (DidReceiveRemoteNotification etc.) I have some user preferences set via Xamarin Essentials Preferences.
I'm looking a way to stop the delegate from firing depending on the preferences set. (i.e if the user has Preference set to get notifications about subject X, they receive the notification, but if a notification about Subject Y comes in, the notification doesn't fire).
I can't determine a way to stop the methods from firing.
Related
I know there are methods to check both iOS and Android to see if the user has locally disabled push notifications for an app, that is done within the app itself. But if a user disables push notifications for an app is this reported back to FCM? Does FCM know not to send a notification to that user and if so, is there anyway of pulling that info out of FCM.
The reason for this question is if the user hasn't used the app in a while and they disabled push notifications - without the user starting the app (thus getting updated tokens/checking for permissions) there is no way to know the user disabled push notifications - unless we can extract that from FCM.
And along these same lines, if a user has uninstalled the app, does FCM get updated that the token is now invalid due to app removal and removes it from its db - and if so, is there anyway to way to extract this from FCM?
In both cases, we need to either update our DB that the user has disabled push notifications (and possibly use alternate communication methods) or mark the user as 'uninstalled' and thus remove that user from any app communication method (fcm, sms, email).
Is it possible to send an individual push notification to a specific user of webview Android application?
I have a webview based Android application. Android 8 blocks all background processes and my application can not anymore check for messages every 5 minutes and to show push notifications is there are new messages. As I understand almost the only solution is to use firebase to show notifications.
My question is: can I send individual Firebase notifications to webview application users? If yes, how? People who login to my website from Android phones, enter their data in a login form that loads my website. It's not a Android login form. How can I at the same time login to Firebase and how Firebase will know that this user is already logged in if it's only a webwiew application?
A webview is not capable of directly receiving Cloud Message payloads. The only browsers that works with Cloud Messaging are those that support the Push API.
What you can do instead is receive the payload in the native layer of your Android app (using a normal Android integration with a service that receives the payload), then proxy it to your webview as needed, using webview's ability to inject javascript into it (while it's visible). This definitely is not a trivial amount of work.
I'm implementing Push in a Xamarin Forms PCL project, and I'm having an issue with iOS.
If the user is actively using the app I want to display an alert to let them know they have received a notification and let them choose to View it (which changes the current page) or cancel.
If the app is not active, either in the background or not running, I want to go directly from the tap on the iOS notification to the notification page - no alert. I have this working if the app is not running.
If the app is running, either in the background or active, the RecievedRemoteNotifications function is called which will display the alert. I don't see a way in RecievedRemoteNotification to determine if the app was already active or if the user tapped the system-generated notification.
Check out the ApplicationState property from UIApplication.SharedApplication.
More information about the possible values here. There is a Background state.
I have a Worklight app doing push notifications. Sending the push causes the notification to appear in the notification bar on both Android and iOS as expected. If the push is received while the app is running, it calls the message handler function as it is supposed to.
The issue I'm having is that if you launch the app by tapping on the notification on iOS, the message handler never gets called if another push is sent while the app is running. I have to exit the app and kill it completely, then relaunch the app from the launcher. Then if the push is received while the app is running, it will call the message handler.
This only occurs on iOS. The app will respond to a received message on Android while the app is running, even if the app has been launched by tapping on the notification.
EDIT:
I did struggle to verbalize the scenario, couldn't find the right words that made sense, but the steps you have done Idan are largely correct for what I'm trying to do. We are doing tag based notifications, so that is different that what you have done. We are also using PersistentCookieAuthentication as they wanted push notifications to be sent without the user having to explicitly logging in.
We are currently using WL build 6.2.0.01-20141216-0427
We've tried it on a couple of different models, an iPhone 4s running 8.0.2, and an iPhone 5 running 8.1.2.
Edit based on the edited question:
Tag-based notifications do not require any login, as it is the device that is to be subscribed to any tags that you define in application-descriptor.xml; it is not login-based, so any type of login that you are doing it irrelevant. The push will be sent to any device (app...) that was subscribed to your tag using the subscribeTag API.
I did another test in iOS using a broadcast-based notification (it's basically like tag-based notifications). I kept the app in the background and sent a notification. Tapping on the incoming notification in the notification bar brought the app to the foreground, which then displayed the alerts of the incoming notification.
You can try it with this application: https://www.dropbox.com/s/l2yk2pbvykrzfoh/broadcastNotificationsTest.zip?dl=0
Make sure to place your own .p12 certificate and pushSender password.
I've been trying to understand your scenario... I suspect you've left out something or need to better word the problem description.
Here's what I've tried using MobileFirst Platform 6.3 (no drastic push changes in iOS between 6.2 and 6.3) and iPhone 6 running iOS 8.1.2.
Launched sample push notifications app (which uses event source-based notifications) on device
Logged-in > Subscribed
Quit application
I then sent a notification by invoking the adapter in the Studio
The notification arrived and displayed in the notification bar
Tapping the notification launched application
Logged-in
The notification alerts were then displayed.
I then moved the application to the background.
Sent another notification, which was displayed in the notification bar upon arrival
Tapping this second notification brought the application to the background, displaying the alerts
I then kept the application in the background.
Sent a third notification
In this case, because the application is in the foreground, the notification did not display in the notification bar -- as expected -- and instead the alerts were displayed right away.
If your scenario is different than the above, such as: you're not even using event source-based notifications but rather broadcast- or tag-based notifications, or your application flow differs, etc then please edit the question with a more precise description.
When you edit the question, also mention the following:
Worklight version and build number
Device model
Used iOS version
I am aware of one possible issue (APAR #PI31988) that is currently under investigation, where the underlying native code dispatches the message before the JavaScript framework is ready to handle it, thus no message is displayed. This was found to happen in slower devices such as iPhone 4.
Can you interrogate the Apple (APNS), Google (GCM) or Windows Phone push notification servers after the fact to find if a notification was delivered?
I know that when a server initially sends the push notification there is a response to say whether the message was processed (but this doesn't mean delivered) or rejected by the notification server. But is there any way to subsequently find out via Android, iOS or Windows Phone 8 if the message was delivered?
Ideally I'd like to achieve this just by interrogating the vendor's push notification server, worst case I'm assuming I'd have to put something in my app to register that a given notification arrived and somehow transmit this success status back to my server.
APNS, GCM and MPNs don't offer this functionality.
You'll have to support it yourself, by sending an acknowledgment from the app to your server whenever a notification reaches your app.
For GCM you can view statistics of deliveries, but nothing for individual deliveries :
Viewing Statistics
To view statistics and any error messages for your GCM applications:
Go to the Developer Console.
Login with your developer account.
You will see a page that has a list of all of your apps.
Click on the "statistics" link next to the app for which you want to view GCM
stats.
Now you are on the statistics page.
Go to the drop-down menu and select the GCM metric you want to view.
Note: Stats on the Google API Console are not enabled for GCM. You
must use the Developer Console.