Jayamal Kulathunge
Jayamal Kulathunge

Reputation: 249

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?

Upvotes: 1

Views: 5523

Answers (6)

Sunday G Akinsete
Sunday G Akinsete

Reputation: 802

Have you heard of Firebase? Firebase. Making a chat app with Firebase is like eating pizza.

Upvotes: 0

Ramakrishna
Ramakrishna

Reputation: 26

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

Upvotes: 0

openmobster
openmobster

Reputation: 1027

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!!!!

Upvotes: 2

dragonx
dragonx

Reputation: 15143

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

Upvotes: 0

Raptor
Raptor

Reputation: 54212

You will require to finish these steps ( at least ):

  1. setup a PHP web server
  2. register for Android Push Notification (you probably need that)
  3. create database schema
  4. write your own codes to allow users to submit & retrieve chat messages
  5. security !!!

Upvotes: 1

Seder
Seder

Reputation: 2763

Yes there is several ways to do this

  1. you can just post to the server and from the server send push notifications to the mobiles
  2. You can make the mobile keep checking for updates if it exists

Upvotes: 1

Related Questions