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
Related
Im building a service that will send an invitation to an event through a WhatsApp group using whatsapp API.
Of course, it will require me to interact with the request to select the group and so on, which is OK, but there is no way (without expending money) for my app to "read" who will join.
I though in sending a link, which on tap, will generate an request on the guest to send me back an SMS, and then my app to "listen" and generate a database of those who agree to be in meeting (my app later will send another message to the group to confirm o cancel the meet according to the amount of people who get involved).
I think i can ask the people to send, but if i ask them to write the sms, they will not do it (lazy people).
There is a way i can write a link like "sms:myphonenumber?ImIn!" to send, so the device will build the SMS for them?
I know from a web u can do something like href:...., and will do the work for them, but not sure otherwise.
I have a problem with the following scenario:
I Send a document from the Server to a mobile Device. I also send a notification about a new document in the inbox at the same time.
Problem is: Depending on the Device's Connection speed, that submission can take a while, so the notification comes in before the document is in the app's inbox.
So I want to send the Notification after the submission is completed.
Question: Is there a way for me to check if the MQTT data transfer is completed without having to have the client send a confirmation?
With MQTT, it is not possible for a publisher to know that all subscribers have received the message unless the subscribers also publish an acknowledgement back on another topic.
I have an android app which i connect to my server using REST API (django rest framework)
here is a scenario(and maybe my plan):
data is sent back and forth as json
I have a user model and a task model where users are owners of some task.
Users typicaly sends a task to another user (with json similar to this: {"owner": "exampleuser", "from":"otheruser", "content":"example" ...} using POST method)
-The tasks has a boolean field "completed" and is deleted once the task is completed (using PUT or PATCH method: completed = true,)
once a new task gets created using POST method, the only way users can see any activities concerning their tasks is through an android activity that uses GET method to get a list of all the tasks owned by the user, by looking up all objects owned by the user
So my questions are:
Instead of having the user to check the app everytime. How can I use GCM to push notify the user?
How will it tell which user or device to send the push notification to?
How does GCM knows when there has been a change to tasks or when a user POST a task?
Android keeps one active connection to Google's servers, but it doesn't use much power or data, because no traffic is sent along it until something sends a GCM message to an app on your phone. There's only one connection on the phone, used by all apps: installing a new app that uses GCM doesn't add any extra load.
The first step in GCM is that a third-party server (such as an email server) sends a request to Google's GCM server. This server then sends the message to your device, through that open connection. The Android system looks at the message to determine which app it's for, and starts that app. The app must have registered with Android to use GCM, and it must have the relevant permission. When the app starts, it might create a notification straight away with the data from the message. GCM messages are very limited in size, so the app might instead open a normal connection to the third-party server to get more information (for example, downloading the headers of new emails).
The advantage of using push notifications is that apps don't have to run at regular intervals to check for new data, saving both power and data. The advantage of having a centralized mechanism like GCM is that the device only needs one open network connection and the Android GCM system is the only thing that needs to keep running, rather than each app having to stay running in the background to keep its own network connection to its own server.
As per the GCM implementation, it requires that you implement a remote server which will manage all the requests, both incoming and outgoing. You can do this simply with a web server acting as a webservice, which will get (for instance) the requests from the clients with a HTTP POST request, and process act consequently.
Instead of having the user to check the app everytime. How can I use GCM to push notify the user?
This will be managed by the server that I just described. It will know who is subscribed and who should receive the notifications.
How will it tell which user or device to send the push notification to?
Same goes here. The server, upon a subscription, should store the users in some kind of storage (a SQL database, for instance), and this way it will know who to send notifications. This implies you'll have to implement some timeout mechanism. In my case, I make clients send a dummy HTTP POST every 30 seconds. If I don't get this request from a reasonable amount of time, I consider the client timed-out and therefore I remove them from the database.
How does GCM knows when there has been a change to tasks or when a user POST a task?
Same story, it's all handled by the server. You implement the logic of what should happen upon any request.
You might want to read this: How to send location of the device on server when needed
And also this references:
Reference on Google Cloud Messaging
Android Push Notifications using Google Cloud Messaging GCM - Android Example
Google Cloud Messaging using PHP
Connection between PHP (server) and Android (client) Using HTTP and JSON
Notificaciones Push Android: Google Cloud Messaging (GCM). ImplementaciĆ³n Cliente (Nueva VersiĆ³n) (spanish)
I am developing a chat application in android in which 2 users chat with each other, it is based on sockets.I want to implement the seen feature just like facebook or whatsapp.
I think may be there is an onfocus method associated with an activity so that whenever user opens the chat activity I can set the latest messages as SEEN in the DB, is there any focus method associated with an activity?
2-Do I have to store messages on local sqlite or on mysql remote database? If I will store on local server, how quickly I have to replicate/update remote DB?
Thanks
In Android the onFocus method you talk about would be onResume(), which is called whenever your Activity goes to the foreground.
Ideally the messages are stored on local database only, there's no point in replicating the messages on a remote server. However this depends on how you want to manage your chat.
Facebook, for example, is obviously server based, meaning that you can see your Facebook messages on any device just by logging in. WhatsApp, on the other hand is client based, and if you buy a new phone and install WhatsApp you don't see previous conversations' messages.
Server based messaging is more complicated because you need to replicate messages, but how often is the wrong question, because it's not time based. As soon as the user connects, you replicate, and store the last n messages locally.
Client based messaging doesn't need replicating, just deliver the messages and you're done. Unless you want a user to be able to send messages when his peer is offline. Then you store the messages in the server, and once the recipient connects, you forward the saved messages and delete them from the server.
Our Android application is a Visual VoiceMail application which communicates with IMAP server to doownload voicemail mails and play it on user handset. As an autentication method application implements sending/receiving OOB SMS from this client. For sending SMS for this application we have following queries
Will our application be allowed to host on playstore as the application is supposed to send OOB SMS whitout letting the user know about it as it is a part of standard authorization method. In reply to this SMS server will response back to this client with an SMS over specific port which will have the credentials for user and client will start working.
If above is not allowed then what are the norms with which we can implement the same behaviour. Please not we cannot ask the user every time to allow sending messages from application.
Will it be ok if we take consent from user at the time of installation that this application will send authorization/validation messages from backend.
Any other suggestion and norms which we need to take care.
The Visual VoiceMail application is limited to users of a particular operator.
This SMS will not charge any cost to the user, It will be free.
Is this possible and allowed for application to be published on Google Play. If not, please suggest a way to achieve this.
Thanks in advance.