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
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.
Hi im working on a project who has an existing iOS app that uses windows cloud platform. Our task is to create a website for the app. One of the requirements is to enable to catch notifications created by the mobile app. For example if there is a new user, push notifications will be triggered and a website link will catch the notifications and save the data to a database. My question is, is it possible to catch a notification from windows azure push notification using a php script event listener?
I don't have any background on windows azure and i don't have any access to there windows azure account. The only thing they said is to give them the link of the script that will catch the notifications.
What are some steps thats need to be done?
Thank you
I'm not sure this is possible. Notification Hubs sets up communications so that you can send a notification out to a many different platforms at one time (Apple, Android, Windows Phone, Windows 8, etc.). Each device registers with the Notification Hub (or the registration is done for them by a back end) and provides a unique device ID, also known as a Channel URI. When you need to send a notification the Notification Hub then disperses that notification out to each of the correct Platform Notification Systems (PSNs) which then deliver the notification directly to the device.
I say all of that to indicate while it might be possible to register a listener that is not a device with the notification hub using a REST based API (You'd have to create a viable channel URI) I'm not sure there is any way to be listening as a php script to a PSN. Also, the registrations do expire from time to time and so you'd need to make sure to keep registering. Finally, no notification system is 100% guaranteed to deliver a notification. The device could be off, it could be in a bad reception area, bad network connection, or the PSN just doesn't delivery it for some reason, etc.
My suggestion is to take a step back and modify the code where the notification is being produced and send it both to Notification Hubs for device distribution, but also send the content of that notification to your database directly, or have them right the message to a queue which is processed in the backend to save to the database if the database isn't local to the code generating the notifications. This removes the notification hub involvement as far as your website is concerned.
If you really MUST look into the php script getting the messages then you can start by trying to figure out how php can receive messages from the PSNs, which is not an Azure issue. You can use the Notification Hubs REST APIs to register for them, but I'm very skeptical of that route.
I'm trying to make a notification system between a PHP server and an iOS device, just like in the Facebook App.
I already know how to make a PHP request via GET or POST and wait for a response. But I would like to receive server's responses without any request, is it possible? Or should I make a request every x seconds?
Look into Apple Push Notification Service (APNS). You send a message to the APNS server, and the server sends a notification to the device(s) you specified. This is standard practice for apps like Facebook.
When the device receives a notification, it sends it to the app (if the app is running) or alerts the user (if it's not). The user can choose to start the app, at which point the notification is delivered. The app can then respond by contacting your server to update its information or whatever.
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.
I need to make chat application for android. I thought of using PHP script to implement the chat application. Basic idea is to send message form android client to PHP script and making use of PHP script send the messages to the MySQL database. These messages will be broadcasting to other people. But the problem is auto broadcasting messages to other people. Is there a way to do this using android and php?
You can do the following
Make a persistent tcp connection between your device and the PHP server
When a message is broadcast send it over the tcp connection of each device
On the device process this notification and you are good to go.
If you want to use Java on the server side I have your project already finished and ready to ship ;) (just kidding)
But if you are interested check out the Device-To-Device messaging framework of OpenMobster Mobile Cloud platform. The project is free and open source. Here is a link to the Device-To-Device Framework: http://code.google.com/p/openmobster/wiki/D2DPushFramework
and http://code.google.com/p/openmobster/wiki/PushFramework
The above three steps are already taken care of by the framework. The developer just has to focus on the App itself
Good Luck!!!!
Yes there is several ways to do this
you can just post to the server and from the server send push notifications to the mobiles
You can make the mobile keep checking for updates if it exists
You will require to finish these steps ( at least ):
setup a PHP web server
register for Android Push Notification (you probably need that)
create database schema
write your own codes to allow users to submit & retrieve chat messages
security !!!
You'd probably want to use Google's C2DM, though it's not free.
Your php server would get a message from a phone, do it's processing, then make a HTTPS request to Google's C2DM service, which sends the messages to the destination android device.
http://code.google.com/android/c2dm/#push-process
Don't use C2DM, its a deprecated. Please go through the GCM(Global Cloud Messaging),
please follow this link,
http://developer.android.com/google/gcm
Have you heard of Firebase? Firebase. Making a chat app with Firebase is like eating pizza.