Pretty much what the title says.
I got a perfect working GCM system which sends GCM push notifications to multiple devices on button click, though im building now a calendar system where users have to register his GCM register id.
Than 24hours before the task runs out i send them a message , 12 hours before the task runs out aswell & on the same time as the task runs out a new message.
It works when i for example refresh the page which sends the GCM push notifications, on the times which i said above.
But i want to let the server send these push notifications automatic.
Any ways how to trigger a function automatic without being on the webpage which sends the GCM or not on the application?
All help is welcome.
Also if there is a way to use this system in the application itself, tell me pls!
I think i can only make it work to use cron in the server itself, but I don't got acces to it.
Thats why im open for all suggestions!
You can use Cron Job In Hosting, so its take a time and write a php script that send the push notification, then cron job on specific time run that script and notification will be send.
Related
I am new to swift and was wondering how could I send commands from a server to my iOS application ? For example imagine a website where I can click a button and that button would then trigger a pop up to all users of my app. Is this possible and if so can someone lead me in the right direction?
Much appreciated
Yes, you can
Silent Push Notification: Send a Silent Push Notification and handle in your app. But you need user permissions to receive Notifications. Add "content-available" : 1 to your notification content.
Using Sockets: There are many options to create connection b/w device and server. example: https://socket.io/
It depends what you are trying to do, you might want to look at apple push notifications and see how they work. From there I would suggest looking into sending notifications to the apple server (that would send the push notifications to the app). I hope this sends you in the right path good luck!
I just assume that you have an application that a number of users are using and you have a web application that can show all mobile users.
For the most of cases, whenever a user is using the application, you let the application send a request with your user's information to your server and your server records the user information in the database.
When your website wants to show all the users' information, it just fetches all the information from the database instead of sending sort of commands to all applications to get information in real-time.
Of course, there is a more complex way to send commands to all running applications to get the results. However, it requires both server-side and client-side (ios application) implement functions sending commands in real-time using Socket or MQTT etc. This is more complex and it requires iOS application running in front or background at the same time.
I assume that using HTTP to record every mobile user is more suitable for your case.
notification on schedule time
i'm trying to send a notification from php to android app. In php i create a notification and send it to app that is working perfectly.
Now i want to send the notification on specific time. but i have no idea how to do that. this notification is send threw jar file (basically it is pick up from database and send to the GSM). But really i have no idea what to do in it.
Someone help on this issue ?
You have to use Cron tasks for execution php script at specific time.
Read: How to set Cron
UPD
You can try to use php Event::addTimer but I`m not sure it will work good if you have a lot of events.
I am using Openfire for the xmpp server and so far its been great. The problem I am facing now is with push notifications. The app is written in Xcode which gets user data from a PHP Api. Openfire is the xmpp server. The issue is that when the app sends a message to openfire I would need to also query the Php api to see if the user is online and if they are not, send a push notification. This would have to happen for each message sent and as you might guess that will affect performance with all those requests happening.
I have everything working, I just cant get past this hump. If only openfire would fife off a request of my choice upon receiving a message.
Can anyone suggest a better idea? Basically need to know if the user is online (presence) before so that I know to fire off the push notification.
One thing also for sending push notification php script is right or openfire have some plugin.
Thanks.
I think using php script to check for offline user is an expensive affair.
I have used ejabberd server. For which you can create custom modules using "offline_message_hook" and using this module you can invoke php script to send push notification.
This hook is called when someone send message to an offline user. Following link might be helpful.
http://jasonrowe.com/2011/12/30/ejabberd-offline-messages/
If you are stuck somewhere, I can help.
I need to send push notifications to my app from my server and i am thinking to use urban airship and i am using PHP at back end. As much i got from urban's documentation ,my server need to send message to urban's server and urban's server will forward it to devices
Now ,i want to automate the process of sending of message from my server to urban's server. Actually, at my server, i am executing a script that go through database and fetch list of users to whom message need to send. so please guide me regarding automating sending process.
Yeah, you can use UrbanAirship (UA) for that. They provide a REST API (http://docs.urbanairship.com/connect/index.html) you can use to send to your audience (UA slang for your users).
So you basically just have to
use UA SDK in your apps. Basically, they will take off when you start your app, register with Google / Apple for push notifications and give you back a token that you have to store in your database
Handle any event where you want to send push notifications in your script
get call the data for the users from your database, i.e. the device type (android / ios / windows phone) and the token you received from UA for that user
send the data to UA in the way they want it (http://docs.urbanairship.com/connect/connect_send.html) and your good to go
If you want to run your script periodically I would propose just using a CronJob (https://askubuntu.com/questions/2368/how-do-i-set-up-a-cron-job) that runs every X minutes / hours / days
I am writing an IOS app that is basically a jabber chat app. I am using Openfire for the xmpp server and so far its been great. The problem I am facing now is with push notifications. The app is written in Xcode which gets user data from a PHP Api. Openfire is the xmpp server. The issue is that when the app sends a message to openfire I would need to also query the Php api to see if the user is online and if they are not, send a push notification. This would have to happen for each message sent and as you might guess that will affect performance with all those requests happening.
I have everything working, I just cant get past this hump. If only openfire would fife off a request of my choice upon receiving a message.
Can anyone suggest a better idea? Basically need to know if the user is online (presence) before so that I know to fire off the push notification and I dont want to fire off two requests from my app per message sent. Thanks.
In openfire the messages to offline users are stored in ofoffline table. So your php code neednot worry about the status of the user if der is any entry in the ofOfline table it means the user was offline. Now create a scheduler that will keep looking in the ofOfline table for offline messages club them together and push notification to the user
i have spen lots of time for in XAMPPHP Library but cant find any proper solution. so for develop a web base chat application with jabber server. rather than using XAMPPHP, you can use "http://strophe.im/strophejs/" it will be much faster than XAMPPHP and you can find more js plugin for Strophe js. and you can also find more ready made xmpp client base on strophe js. so it will better than XAMPHP.