Is there way a user can send a push notification when button clicked like push notification but from inside the application? . I tried to use local notifications but the notification is sent only to the user device and not to all the devices the app is installed on.
Thanks a lot.
It depends on your server, write addition Api that trigger push notification.
Related
I am currently aiming to make an app in Android Studio that allows one user to push a button and another user to receive a push notification as a result. How might I do this?
You're going to need a server to act as an intermediary. Set up an API endpoint that your app can call to request a notification, and have your server dispatch a message to the receiving device using something like FCM.
I am trying to figure out how Facebook / Twitter sends push notifications like "You have 20 new followers"I don't know how to call it but i want to learn the underlying algorithm of this in Android. Please help, Thanks !
On Android you can execute your code before actually showing a push notification. They could simply send a push notification to all devices with an identifier, then the app can make a request to the server and get the needed information in order to show the push notification.
They can also send one push notification per device, as they can associate the push notification key with the user login, and the server would fire a push notification every time there is an event that demands a push notification.
But there are also other ways of doing this, for example, they can, for example run locally in background and create a local notification when the app decides it is necessary.
I am using push api from OneSignal.com to send notifications. It's working perfectly but I want to receive notifications only if app is Active. If app is closed or not active then Onsignal notifications should be stopped.
Is this possible with this service?
I'll really appreciate for any contribution.
Thanks
You does not send push notification on active user however you have send notification using creating segment with adding filter last session time.
I have implemented push notification in my app sucessfully using GCM.
I Am using my dotnet webserver to send push message to my app vai GCM Server.
I have stored GCM Registered Id in database on my server.
Now I want to check that if user has manually disable/off the notification for my app (by going through setting), so that i can send request to my webserver that not to send push message to that device by removing GCM ID from database(unregistering).
I know push messages are delivered to my app and are ignored if notification is off but my problem is that my app is going to be used by more 100000 users/devices and if only few of them are using notification on, then there is unnecessary traffic of sending push messages over 100000 devices/users.
So is there any way to know the status of the notification on/off programmatically so that i can send request to deregister the app on my web server?
I have googled and found that there is no way to find it out, so is any one has other solution for my scenario.
Please help me on this as i am stuck on this from last couple of days.
Thanks in advance,
Ketan Bhangale
Store user status in SharedPreference and check status while displaying notification.
same status you can store on your server and sort list of sender with status.
The ability to disable an app’s notifications is only for devices currently running Android 4.1+ Jelly Bean. Also there seems to be no documented way to know the value for notification flag(check box) in default application settings.
Simply you need to maintain that manually. Say first create a web service for update "notification setting" . The app will send the value for notification say "true" or "false" as chooses by user fro our app settings menu.
Now at server side store that value for notification_flag corresponding to that user in your db.
Before sending the notification to the user on your desired even(as per app requirement when to send notification) , check first the value of the flag before firing the send notification msg on the device id for that user.
Also finally to be more reliable at app end too , check the value for that flag before showing the notification in the app when the message arrived.
I need to have a toggle for push notifications in my app, but I can't make changes in server. Can I intercept the push message in GCM and not show it in the topbar?
Since you are the one displaying the notifications, you do not have to "intercept" anything. You are already receiving the GCM messages, with the code that you wrote, where your code is displaying the Notification. Simply have that code examine your SharedPreferences (or wherever the "toggle" is stored) to see if the code should actually display the Notification.