I am trying to develop an android app that verifies a transaction initiated from a browser on a PC. I want the server application to push a notification of a new transaction to the app so the user can confirm to complete the transaction. The tricky bit is the transaction is specific to a particular person (I'm using this as an alternative to sending an SMS for example). Can anyone help on how to go about this? Is it possible to do this with C2DM or GCM?
Using Android GCM is advisable. The complete reference to GCM is available at
http://www.androidhive.info/2012/10/android-push-notifications-using-google-cloud-messaging-gcm-php-and-mysql/
Step by step GCM development is given in there. It is really very helpful. Hope this is helpful to you.
The critical thing you need to keep in mind before making a decision is that when you are using GCM, you need to keep a track of the users by keeping their GCM_ID in your database. You can add a gcm_id column to your users table for this and whenever the user opens your app, the gcm_id should be updated in your database. The gcm_id of the user's phone can change, from the official docs:
Note that Google may periodically refresh the registration ID, so you should design your Android application with the understanding that the com.google.android.c2dm.intent.REGISTRATION intent may be called multiple times
GCM push notifications wont be able to reach your users mobile phone all the time,especially if his phone is not connected to internet or switched off.You are using this for transactions etc, so I assume that the notifications must not fail. You should keep a check in your web application to send an SMS or notify the user that this has failed. You should get a response from GCM to your server through which you can identify a failed case.
Related
I am developing a web push notification system using Google Cloud Messaging (only web). I am using a GCM registration id to send the push notification in an Android device.
Can anybody tell me if there are any cases or scenarios that the GCM registration id will be changed for a device?
FYI, I would like to share my current knowledge:
The GCM registration id will be changed if the application is updated or re-installed.
If the device OS is updated.
My system design is as follows:
First, I register the registration id of the device in my database ?
(This is the only one time my client access my site and be able to get the registration ID and where I save it).
Then, I send a notification after a month or later (it depends, maybe even after 3 months).
Here are my questions:
If the device OS was updated in during that duration, does the device id change?
If the Chrome browser is updated or reinstalled, does the device registration id change?
If the registration id does change (because of one of the reasons above), how can I send a push notification to the desired device?
Appreciate the help. Thanks in advance.
We have firebase chat application (check any chat example or tutorial) that will have same copy as our.
We would like to sent email notification or sms message, if user hasn't seen the chat message yet.
We can connect to firebase database with php and check all the messages, if they are seen or not. but It's not really proper way of doing it.
Does anyone have idea how we can implement that, so we can track of all the messages and if they haven't seen it, then sent the email / sms notification based on user preference?
I just want to know how we can do that with firebase. if it was just php and mysql. it was really easy to do this.
Not sure if this can be done efficiently in Firebase. You will have to setup a cron job to fetch the messages which are not seen and trigger SMS/Email fallback.
I would recommend using Applozic (https://www.applozic.com) for Chat related stuff and Firebase for storing user meta data and other data.
Applozic provides a single click configuration to enable Webhook/SMS/Email fallback, along with that you will get all the whatsapp like chat features along with full UI with no need to write any additional code.
I am trying to incorporate GCM push notifs to my app. I was reading a tutorial but unfortunately it uses REST api and slim framework and I don't have an idea on those and it will be time consuming for me to study about those. What I am thinking right now is to just SIMPLY assign each user in the database with a gcm registration id and send them a notification. But the problem is I don't know how to get gcm registration id in the simplest way. I have less knowledge when it comes to PHP or server side. Can someone help me or just give me a link tutorial using simple implementations? I would really appreciate it.
By the way, the purpose of my push notif goes like this: On a specific period of time, let's say on a specific date, there will be a list of app users that are qualified for a contest. Those users should receive a notification on their phone once they are connected to the internet.
I was following these articles: Verifying Back-End Calls from Android Apps and Stopping Vampires using License Verification Library (from 24:57 to 25:34) to implement an In-App Purchase verification system for our Android apps.
I am a bit confused about how this works end-to-end and what we can assume about the generated token from calling GoogleAuthUtil.getToken() with the first email address found--when AccountManager returns more than one account. My questions are as follows:
Should we assume that any e-mail address used by the user to buy our
app will generate the same token (i.e., same user + app ==> same
token)?
If the answer to question 1 is no, is there a way to launch in-app
purchase for a particular account/email?
It looks like Google is picking the first e-mail address returned by
AccountManager for its in-app purchase dialog. Can we assume that
this won't be changed by the user after in-app purchase dialog is
launched? How do we find out if this changed after the in-app
purchase returns?
What should we store in our database to identify this user? Is email
address and/or token allowed? When does the token expire?
The java-client library looks very promising and powerful at first
read. But, a number of things remains confusing. Is there an article
that describes the end-to-end scenario--from an app initiating a
call to a back-end server through launching the in-app purchase
dialog, getting the result and closing with commits on the server?
What articles are the most useful for accomplishing this on Android?
The main issue we are trying to solve is to to get the full picture.
We've gotten the idea that we can avoid requiring userid/password by using the java client features and using tokens. We have registers our project (both the web app and android app on the same project) per the instructions for Google API Console. We have the php java-client for Google Play Service on our back-end server. We got our Android app to generate a token using the first email address and then call the in-app purchase dialog and handle the user response at the end of the dialog. We've got the parts. Now, we need to glue everything together. We are at the point of integrating with the back-end server. E.g., What is Redirect URi supposed to point to in our server? We've got a php url that we do http post messages to for our server app. We've included the code example for Google API client example--with client-id, secret, simple api key, etc. filled in--as an include to our php. But, what should we put in the redirect uri (we are missing a usage instruction for the example code)?
Also, we want to avoid having the e-mail used for the in-app purchase be different from what we log on our server database as the address the user used to buy our app; if the address is the correct thing to track, we want it to be the same as what was used for the purchase. This could be frustrating for our user if we make this mistake and prevent them from the features they paid for. We don't want to make this mistake and need some clarification on how Google Play Service works. If we initiated the server part of the workflow to get app Nonce / Payload / Credentials for the first e-mail address on the Android device, we would want that address to be used throughout the workflow. If the user changed this along the line, we want to be aware of this and gracefully recover. So far the articles have been helpful but incomplete. Any insight/suggestion is appreciated.
I am about to undertake the development of an app that requires sycning of data from the local device to an online DB...and back.
I am building something that will allow users to create events and invite users to those events. Users will also be able to chat and receive in app notifications. I would like to store the information in local storage that the user creates and push this information to an online DB when there is internet available. Then if there are any waiting events or notifications for that user, they can retrieve them when online also.
My concern is about the merging of data and the fact the local storage PK's will not be the same as the online PK's.
For example, user1 and user2 both just installed the app. They both create an event and invite each other to the event. Once they are both online their devices try to push the data to the online DB however there is a conflict with the PK used.
My question is: Can someone give me some guidance about how best to handle a situation like this? The app will be built using AS3 and Air and only for iOS and Android. There will be a MySQL remote DB with a PHP backend.
Any help is appreciated.
You could also send a time stamp of when it was sent to use with your PHP, where the request that got there last has an event sent back to notify the user (probably best with a push notification) that there has already been an event made.
Also not sure if you know already, but you can use NetConnection status to get a sense of when they connect to the internet.
localNc = new NetConnection();
localNc.addEventListener(NetStatusEvent.NET_STATUS, netStatus);
function netStatus(event:NetStatusEvent):void{
trace(event.info.code);
}