Can I send user notification after someone calls the user in Flutter? - flutter

I have just started to learn notifications in Flutter.
What I want to do is when someone calls user, I want to check callers number if it is not saved, send user some notification.
I can check if the caller's name is in contacts, but when user opens my app. Is there a way to make flutter app work in background, and whenever call happens my app checks if it was unsaved contact call, and if it was send user a notification.
Does someone how to achieve such thing?

Related

How to check if my Flutter Web app is currently running?

I am building a chat app in Flutter Web, and would like to add a feature for flagging when the user is "Online".
I want to send a bool to Firebase Firestore whenever the user launches and closes the app (for example, when the user launches the Flutter Web URL = true is being sent to Firestore for isOnline flag. And when the user closes the tap = false is being sent to isOnline).
For that, I would need a way to detect the lifecycle of the Flutter Web app, and to check whether the app is currently actively running or not.
Does anyone know what is the best way of doing that?
Thank you!
While you can easily update your firestore whenever a user opens your app (just add it to a point executed on launch, like before the runApp() part in your main method). However, there sadly is no guaranteed way to know, if a user closes your app. It could be force closed via task manager etc., robbing you of the ability to detect it. However, firebase offers the following solution to detect presence, see here.
You could also save a timestamp as the isOnline point and let it timeout. You could update it periodically in your app, giving you not a perfect but maybe a good enough idea if a user is online.

Handling Local Notification in objective C

I am working on an iphone app where I store all the local(and push) notifications for my app. There will be a screen on app which shows all the notifications generated by the app. My question is that can an iphone app know when a local notification for that app is shown. for example, suppose that a local notification is shown, but the user simply ignores that notification, and does not tap on it, so in this situation, can my app somehow find out if the local notification was shown and do some processing on it(for example, store the notification data in sqlite database).
I have tried both "didFinishlaunchingWithOptions" and "didReceiveLocalNotificatios", but from my understanding, they are invoked when a user laucnhes app by tapping on the notifiaction, is there a method by which I can have the notification data even when user does not tap on the notification.
tldr; can an iphone app handle(process) local notifications even when user does not launch app by tapping the notification.
No, your app wan't get any notification whcih user has ignored. Your app will notified only when user presses view or tap on that notification.

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

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.

Showing Badges in iPhone Hybrid Application

We are developing a hybrid iPhone application. It has a webview that loads some mobile website. Website requires user authentication and once user is authenticated we need to show badge count for unread messages.
We are looking to use Push Notification to show badge count but I am not sure how should we register for push notification dynamically once user log-in and de-register once user log-out.
I believe if we can have some way to invoke native class method through javascript then we can achieve it.
Please suggest.
It is very simple whenever user logged-in, post a entry into the db and send notification for the records entered into the db and when user logging-out delete the entry from db

Re-opening the app after finishing a call

I have a button in my app to make a telephone call, and I need to returen to my app after call is finished.
Is there any way to do this?
Can't be done. The user will have to open your app themselves.
If you mean that the user can make a phone call to another user, starting from your application, which closes said application, then what you are asking is simply impossible. The best you can do is have the application get into suspended mode. The user will need to get it back from the tray.
If for some reason your application has a button that calls the user (possibly by triggering some external server), then you should edit your question to be clearer... however, the user still needs to get your application back himself from suspended state.