How to push to iphone / android phones via php - php

How can I use a php script to push to an iphone or android phone?
What I am thinking right now is to have a php script that will run every 15 minutes on a web server, check if case x is satisfied, if not push a notification to the phone.
How can this be accomplished if its even possible? If not what approach should I take to achieving this? Any links or break downs would be greatly appreciated.

Instead of reinventing the wheel, how about using an existing tool such as Urban Airship? They provide a PHP library as well as a super-simple example using PHP's libcurl.

If you want to send the notifications yourself, you'll need to read up on sending push notifications to each platform. This SO question (and answer) address sending notifications on Android. This article is one of many in addition to Apple's docs that explain the process for iOS. If you use a third party service like Urban Airship, you'll need to look at that API instead.

If you want to setup your own server for push notifications, you should take a look at Easy APNS. It's a PHP library for push notifications which is very easy to set up and customize.

Android Cloud to Device Messaging Framework is used to push notifications to Android devices. You can develop server part yourself or use existing service such as Urbanairship. It allows you to send pushes to both Android and iPhone but you'll have to pay for it.

Related

Wants to make push notification app like WhatsApp

I want to make an App with push notifications, which will not stop in Android phone, exactly like in WhatsApp.
I can easily make a php API for notification on my xyz web hosting to send push notifications to my application.
But I don't know which methodology to use. I am a beginner in Android App development. I want to make the App using Android Studio.
I appreciated if you could share any example source code.
In this case using google fire base is a good choice.search about it.

Notification to android without GCM

I have a android application on PlayStore. I used PHP and MySql for sending data to android. I want to send notification to all users who downloaded our application .I don's want to use GCM for notification.Is there any method to do it?
Almost all the answers you can find aren't real answers. Parse, pushwosh, Amazon SNS and many more use GCM at their core. Yes there are reasons not to use GCM e.g. if developing an SDK that needs easy integration into apps that aren't under your control. https://pushy.me/ is one of the very few I found so far that doesn't use GCM at all.
I also found this: https://docs.kii.com/en/samples/push-notifications/push-notifications-jpush/ but unfortunately there's nothing about pricing.
There are many third party libraries out there such as urban airship, amazon sns etc.
See this
http://docs.urbanairship.com/platform/android.html and this
http://docs.aws.amazon.com/sns/latest/dg/mobile-push-gcm.html
You can use Pushwoosh SDK to send notification.
http://docs.pushwoosh.com/

how to implement custom mobile push service

i just need to get some information about a solution i'm trying to implement.I have to write a push service that can be used to push messages to android and ios apps the project is an ionic app.
So far i have come across Google Cloud Messaging ,Firebase ,Pusher ,push.ionic.io but all of them are third party.
Is there any documentation that explain how to make such a push service using php.I have previously worked using rachet for websocket.As i understand this type of service must be based on websocket.
There are various resources available out there regarding implementation of Push Notification services in php. Let me point you to couple of those.
Simple Push service in php
Have a look at this.
So if your concern is implememnting Push noification on client side using ionic. You can use ngCordova's cordovaPush. You can find it here.
cordovaPush really works great both for android and iOS.

How can i get data to be pushed from the database to the client, like a messenger service?

I am trying to code a messenger service that will store sent messages in a server and then push the message to all devices connected to the server.
The messenger will be used in a classroom environment and the messages will never be sent to one individual device. At the moment a message can be sent and stored in the database but the app needs to be refreshed for all the messages to be displayed. A simple way would be to continuously run the stored procedure but that would require extra bandwidth and i'm sure there is a better way to do it.
I am currently coding in Android Studio and I'm using MySQL as my database and PHP for my stored procedures. I am very new at Java and this type of coding so any help will be appreciated.
Thanks
Yes, what you are suggesting is named "polling" => check if the server has some updates each 10sec or something like that. You're right, it's evil (drains the battery, use a lot of bad=ndwidth, etc.)
What you need is a "push" service. If you are working with Android, the easiest way of doing it is to use GCM (Google Cloud Messaging) : http://developer.android.com/google/gcm/index.html
This little guy will provide you a way of notifying all the devices that theure have been some changes on the server.
It's pretty well done (if it can't reach the devices, it will try again with an exponential time delay, etc.).
You can use google cloud messaging service to send notification in device so please register your application on google service all step are cover below link.
Open below link and follow step
http://www.androidhive.info/2012/10/android-push-notifications-using-google-cloud-messaging-gcm-php-and-mysql/

Making Android chat application from scratch

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.

Categories