I am developing a kind of trading android app. In the application, a user can send a request to another user through online in real time and the other user can either accept or decline it. The concept is like calling someone that if you call a person, the application will prompt him if he wants to accept or decline it. How can I implement this kind of function in my application?
a user can send a request to another user through online in real time and the other user can either accept or decline it. ... How can I implement this kind of function in my application?
With Google massaging system ( push notification) you can ask your server to ask google server to send a notification to the user. He will receive, when he has data connections and server and stars are aligned...
Then the other user can accept / reject, which will send a HTTP request to your server and that will notify you via presented messaging system.
The second version is to write an app, which send an SMS with an application code content, this doesn't need Internet connection, but may involve some additional costs for communication. Anyway this is the fastest safest method, in my opinion.
How to send SMS: https://www.tutorialspoint.com/android/android_sending_sms.htm
Android listen the incoming SMS: http://androidexample.com/Incomming_SMS_Broadcast_Receiver_-_Android_Example/index.php?view=article_discription&aid=62