For a final year project I'm creating an app which has to function as a plugin to a learning management system such as moodle. Basically, once an assignment or new notes are being uploaded on the website, it should send push notification to a mobile app.
I have created an equivalent of a moodle website and you may upload files there. It's created in php and is running on XAMPP server while the app is created in jquery mobile with some javascript in it. I'm completely clueless when it comes to coding as I'm enterprise computing student and we were thought only the basics of programming and it's been two years since we had any sort of programming module. It doesn't even make sense why we have to do a prototype..
Anyway, could someone please recommend me the best approach to take to make this work? I've been trying to implement it by using this tutorial https://pusher.com/tutorials/realtime-notifications#/lang=php but it doesn't work. Is there anyone with expertise in this field and could let me know if this tutorial is the correct one or are there any better approaches. Your feedback will be gratefully appreciated. Thank you!
Sending push notifications in PHP isn't difficult at all, but you do need some vital information before you can send a push notification.
1) For iOS, you need to create a application on Apples system, and generate a PEM file from your application certificates, Generate .pem file Used to setup Apple PUSH Notification
2) You'll need an iOS application running on the phone you want to send push notifications to (I believe this is true)
3) When the user logs into the iOS app, you'll need to send the users deviceId to your web server and store it while also associating it with any courses the user is registered against in Moodle.
4) Finally, you use the users deviceId and the PEM file to send a request to Apples push notification server to send a push notification. see http://codular.com/sending-ios-push-notifications-with-php i.e. when a file is uploaded, grab a list of users that are registered on the course, then loop through their device_id's and send a push to each user.
Android is a little easier as you use an API_KEY rather than a certificate. But again you still need the users unique deviceId.
I've build a fair few API's for Mobile Applications, and this is how we do it. The key things are you need a mobile app, certification/api_key and each users deviceId.
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.
I tried searching these issues. Some sites say I need to do some stuff with php in order to make 3rd party server while others don't mention anything. some says it need JSON. Guide me please. PS I am a beginner and know java, XML,SQL only.
You should only need one server. The second server you are reading about may be the Google GCM cloud server? When I did a GCM project a few years ago, I had one server, it happened to be a App Engine instance. It generated events and sent them to Google via the GCM api and then onto onto the device. I don't remember it being that difficult.
I did have more than one server in the mix though, there were others that sent messages to the AppEngine server, but it was not required to send a GCM message.
Google Cloud Messaging (GCM) is a service that enables developers to send data from servers to both Android applications or Chrome apps and extensions.
So if you want to send data to the users of your App then you must have an interface or dashboard from where you can send some data (typically push notification) to the users of your app.
This dashboard (server from which you can send data) can be developed by using PHP or any script languages.
Now a though can come up in your mind:
"I am suppose to develop both the mobile app and the server then what
role does GCM play?"
Yes, GCM is playing a vital role indeed. The server we have to develop is just to design an interface so that you can type your message/notification and select the recipients. Rest of the part of (managing the queue, communication with the apps checking for authentication and all other stuffs will be done by mighty GCM )
In order to have an bird-eye overview you can take a look on this image collected form android hive
Server side coding is doesn't need you to be expert in php. So you can go through to this article. It helped me a lot to learn.
I have to make an application that receives commands from a website and therefore perform an action.
I thought about creating a login in android to send the username and password for POST and if this is correct, the web server will return a unique token. That would serve me later to send information to the server and ensure authentication...
But ... how can my android application know when the website has a warrant for?
I've thought about that all the time is pending a URL "checkOrders" and if it finds your token, request orders to another URL
Anybody know other method to make it?
If I understood your question correctly, the only (battery and otherwise) efficient way is using push notifications. Unfortunately, this approach is not even close to being simple.
Since you're developing an Android application, you may want to consider Google Cloud Messaging and Parse Push. If you're planing on developing apps for iOS and Windows phones in the future, I'd strongly recommend Parse Push. At the moment, it's free for up to one million users.
Hyperlink for GCM will lead you to generally useful reading on this topic. That's why I am not elaborating here.
I want to create a mobile app for an exisiting website that runs on PHP and MYSQL. Phonegap users, please kindly inform me if it's possible to send mobile notification by interacting with my web application?
Here's an example for better understanding: A web application where users create a list of to do's. User entries are stored in a web database. The objective is to send notifications to their phones via the website server when a "to do" event is due. Can this be achieved with Phonegap?
Yes. Yes it can. Have you tried much yet?
Notifications while inside the application are a snap - just a regular getJSON poll to some kind of endpoint will work. If you want to use native notifications, that's harder.
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.