phonegap ios) is it possible distinguish push notification that user clicked? - iphone

I am using phonegap push notification plugin and all seems work fine. push comes without any problem.
But the problem is there is nothing I can do when app is back-grounded.
multiple push notifications can arrive when app is backgrounded. I can not expect which push
notification user going to click. Whatever notification user clicks, app will be resumed without
information of user selection. I have to trigger different events depanding on what nofitication
user selected. I need to know what notification user selected when app is resumed but don't
know how to... seems very tricky problem. is there anybody had same problem?
how did you guys handle this problem?
any help will be appriciated.

never mind...
I thought window.plugins.pushNotifiction.getPendingNotification would return all pending
notifications which arrived while app is background.
But getPendingNotification function only returns the notification that user selected on
notification center or mobile screen.
well... seems nice..

you can`t get all notification information which fire during application is off or app. is in background but, you can fetch user info shortly receive notification in native iOS app.
please follow this application:didFinishLaunchingWithOptions.
At first call of launch you can check for options and retrive the user-info.
for more info refer above link.

Related

Share data, received from notifications when the app is in the background to main app

When the App in background I handling notification data in the _handler.
FirebaseMessaging.onMessageOpenedApp.listen(_handler);
It's working good.
On notification click the App start and need to get the notification data.
How do I inform the App?
I'm trying with shared_preferences but its working with delay
I know the reply is a bit late, but maybe it's helpful for someone else.
For me it works using the handler. It's described in the documentation at https://firebase.google.com/docs/cloud-messaging/flutter/receive
Check the chapter "Handling interaction".
Using that example I can pass notification data in the app, as soon as it is started via a received notification.

Get all notification messages (if any) when the app is opened using app icon

I was working with flutter and I managed to implement FCM push notification in the app. The FLUTTER_NOTIFICATION_CLICK click_action works fine.
But, I need to perform that similar action when the app is launched by clicking the app icon. Is there any method to do so?
Ultimate goal is to perform similar action when the app is launched by clicking the notification or by the app icon (from the app drawer). Please help me with this.
As far as I know, there is no way to get the received notification content when the app is opened using app icon in Flutter. I tried to find a method, but as of now, I am at zero.
Flutter with FCM supports only onLaunch and onResume click_action events for notifications. If you are able to write some native code, I think you may be able to do this. A simple work around I can give is that :
You can clear the notifications as soon as the app is opened using NotificationManager in Android. Here is the reference.
After that you can fetch the actual notification messages from your server(if there is one) and show it to the user.
This is not an accurate answer. But this is what I finally did. Not sure if this helps.
If you click and launch from notification
You can listen that 'onLaunch' method in firebaseMessaging.configure
But from 'app icon' is no way as far as I know.

An alert like whatsapp when app is in background in ionic

I am using One Signal push notifications in my ionic app. I want to show an alert when i receive a notification when my app is in background.
I tried using the platform pause and remuse functionality to check for background and foreground and then generate an alert when app was in background using ionic alert controller but was not able to produce the desired result.
I want a pop up dialog box like one in whastapp when u receive a message.
Can anyone please suggest a solution to this.
There is no way to achieve what you're trying to achieve through the use of OneSignal alone. The OneSignal plugin for Ionic has two calls to action:
handleNotificationReceived() & handleNotificationOpened()
The first one is called when the notification is received and the app is in the foreground.
And the second is called when the app is launched from the notification.
You would need some other service to record when notifications are sent to see if there were any when the app was launched by itself. If you use OneSignal's REST API to send notifications yourself, you can record when a notification is sent, and then when the app is launched by itself, you can fetch missed notifications or notification count from your own server. That's just one way you can do it.
But OneSignal is a push notification service, which send notifications. Even if you did FCM yourself and went through the scenario you mentioned, the results would be the same.
It's not a OneSignal issue. It's the way notifications are designed.

iphone programming adivce

Hello I was wondering if there are any methods that would allow me to interact with the iphone users. What I mean is like UIALERTVIEW of some sorts that will popup and update them with a status. But I don't want to have a fixed status, but one I can change anytime I want, like say if there is a day off, I want to provide a status over the air and when the user opens the app it will show the new message.
Is this even possible?
If there are any other alternatives please list them
The easiest solution would be that your app is contacting your website and downloads any message it should show on startup.
You can use Push Notifications to send users important updates automatically.
What you are looking for are called Push Notifications. They can put small numbers on your app's icon like the email app when you have new emails, or even show you popups when you need it. Start here: https://developer.apple.com/appstore/push-notifications/index.html
you can use Push notifications .. or build your own notification system by design a function fired when your application launching to contact your website and check if there any new notification .. then you present a pop , view whatever to show the notification.

iPhone Notifications is possible to

I read more post regarding iPhone notification, and I have a simple question....
Where a device receive a notification (so I can display a message contains the message notificatio ti advise the user).
I understand that message is managed by the application.
The question is:
...when my application receive the notification is it possible to start it?
Or in other world the application became run when receive the notification or it simple became active only to manage the message and at the end of notification management the app return to sleep?
The main application windows is opened on the device ?
Many thanks in advance
Lukenukem
Ciao
With push notifications you can prompt the user to take action, which if they agree (by tapping the "open application" button), will open the application automatically.
The caveat is that you can't do this without the users consent. They have to tap the open application button for your app to open. There's no way to open the app automatically without the user's action, nor is there any way to open, perform the required actions and quit the app automatically.
The apps dont "sleep" they are either running or not (till 4.0 OS that is), im assuming you are asking about push notification, what happens when a user receives a notification is that they can choose to close it, or go ahead and "view" the notification which can cause the app to open automatically...thats as far is it goes in the current system i blive...