Search code examples
androidandroid-emulatorpush-notificationandroid-c2dmxtify

How does Xtify registration works?


I am currently implementing a push notification feature on my project. I managed to use xtify for doing this since it is a good wrapper for interacting with Google's C2DM services.

Now, as most of you probably know : xtify uses an identifier called xid to communicate and push notification to users. So in my main activity (the first displayed when the user opens the app), I have the following code :

    XtifySDK.start(getApplicationContext(), Constants.XTIFY_APP_KEY,
        Constants.C2DM_SENDER_ID);
    String xid = XtifySDK.getXidKey(getApplicationContext());
    if (!"".equals(xid) && xid != null) {
      App.setXid(xid);
    }

now my questions are :

  • Is the xid permanently attached to the device ? or Is it possible to change/revoke it ?
  • Should I store it in the database then (with the user info) ? and check each time the user connects whether he/she already has an associated xid and if not, call

    String xid = XtifySDK.getXidKey(getApplicationContext());

to generate a new one ? - Is there a way for the android emulator to get notifications ?

thanks in advance guys,


Solution

  • The XID is assigned to the device upon install. It won't change unless the user re-installs the app or the developer changes the AppKey. You should persist the xid along with your user record (asyou would with an email address or SMS phone number). You need this XID in order to send individual messages to specific users via the API, for example:

    http://developer.xtify.com/display/APIs/Push+API+2.0

    You don't need to necessarily check the XID everytime, but it may be a good idea to do so to handle the corner case of a user re-installing the app, but keeping your own app generated UUID or their username.