Sending a message to a contact on another Android device - android

While building my first Android app (a simple game), I came across this (most probably newbie) problem:
my app needs to send a message to a contact (chosen from contact list) via my own server.
same app installed on this contact's device, needs to retrieve this message.
The problem I am facing is contact "identification". How can the app identify a contact such that one device sends a message for this "ID", and another device polls for messages intended the same "ID?
Maybe there is some kind of ID associated with a contact having an Android device?
Thanks (and sorry for newbie question :)

You can try push notifications service, by using the google cloud messaging.
From the first device you can send an http request containing message to a server that manages the request and sends message to the second device, or to more than one device.
You can find a tutorial here
https://developers.google.com/cloud-messaging/

Related

Can I have a web site communicate with my android phone so that sms are triggered on the web site and sent from the phone?

I have a project where I want to send a small number of text messages to my client's clients. The automated sms details and timing are stored on a web site and currently, we use an api to an sms provider to send the messages. However, the client has an office mobile phone (android) with unlimited txt account and would like to have the web site send the message details to the android phone so that it can be sent from there at no extra charge. The phone could be connected to a computer via a cable, but it would be best if the details could be sent to the phone via internet. Any thoughts?
Easy way:
Just store any thing you want to send somewhere like your database, Then Develop an app for your client that calls your server lets say every 10 second and sends the messages.
Better way:
Use google push notification to send data from your website to your client phone!
Even Better way:
Tell your client No! Tell him/her that the idea is stupid!

it is possible to send push notification from one android app to a different android app?

Just wanted to check if it is possible to send push notification from one andriod app to a different andriod app considering both the apps has different product id and browser keys. If its not possible then what is the work around other than picking up the message from SMS inbox and displaying it ? The purpose is to have a merchant facing app and a different consumer facing app for intraction. So if a merchant push messages it should come as notification in the consumer app.
Yes, it is possible. You need to obtain registration ID from the application you want to send the push message to and to know the API key. Just like when you want to send push messages from a server.
However, if there is a server involved, it is better to use the server to send the messages instead. It won't need to deal with unstable network connection.

Comunicate between two devices using the same android application

I am new to android. I am developing a simple app to communicate between two android devices...
I am going to make this scenario for my project to make comunication between two android devices.
Is it feasible or not?
Is there any way to make this communication simple...
1.Register user with GCM after app is installed
2.store registration id with phone number.
in the application...
3.Select the Phone Number Of the Person you want to chat with.
4.Get the registration_ID(GCM unique Registration ID) corresponding to the phone number from the Server.
5.Send Request Message to that mobile using GCM.
6.The other user sends response message by finding the registration id from the server and communicates with the other mobile using GCM.
After that the communication between the two devices should happen by using the known registration id of GCM....
Thanks in advance :) :) :)
Yes, you could store the registrationId of an app together with the device's phone number (assuming it has one, i.e. not a tablet without phone connection) on your server. You should be aware that several apps which use GCM could be on one phone. Each will have a different package name and therefore different regID.
There is not necessarily a one to one relationship between phone no and regID, instead it is one to many.

Phone location on call or SMS

I am an android applications developer. I just wanted to know that can we get the geo location of a phone number just by calling or sending an SMS to that number? Like in whatsapp, we can see the last seen time of the person, likewise can we get the last seen time with the exact last location. This is found in facebook messenger. I am just curious if it is possible using just a phone number.
Android apps that share current user(phone number) location identify there users by phone numbers, i think you already sent an SMS to Whatsup or Viber service before using it and you must put your phone number in your Facebook profile, those services can stock last known location of there users periodically (each 2 hours) or each time the user use this app in there servers and share it with other users check my detailed answer here https://stackoverflow.com/a/21714011/1889341
No, the call and sms data not contains position(as geo localiation) and Android is not able to get them on receiving call that i know.
The only way is to create a custom Service android that catch the event of outgoing call and send the position to your own API server on to register this event and work with it.
Whats app and facebook are not normal SMS message. Are response to a web service that contains custom data. The facebbok and whatsapp developer have created a data structure that aggregate the informations of geo localization to the message data.

sending message from one emulator to another through C2DM

I have read the tutorial of C2DM from given link
C2DM
I have followed the steps and able to obtain registration ID , authenticaton token for my device .but I don't understand how the C2DM server will come to know to whom the message is to be delivered.
When I send the message it is received on the same device , but i want to send this to other emulator.so I want to know that for this whether I have to make another applicatin with the same content or I can launch two emulators from the same appliaction and send messages from one to another .
Now my main question is :
when I give the registration Id And token it's actually of the sender's or the receiver's
whether I have to make another applicatin with the same content or I can launch two emulators from the same appliaction and send messages from one to another .
You should be able to just make one application and use two different emulators.
Now my main question is : when I give the registration Id And token it's actually of the sender's or the receiver's
Let me see if I understand you correctly here. You want to send a message from one device to the other right? Well you can't contact the other device directly. The best you can do is have the sending device post a message to the server with the id of the device you want to send it to. Note this probably won't be the other devices C2DM id (that could change for what ever reason), but rather some sort of name for which your sever will then have to resolve the C2DM id. Then, when the server gets the message, it figures out the id of the phone to send it to, sends a push to the recipient's phone, and then the recipients's phone downloads the data.
Does that make sense?

Categories

Resources