0

One on My Android application i need to implement push notification using Rhodes without using Rhoconnect.I tried with google cloud messaging .But not able to get register android device.Please help/guide me the flow how device will get register for sending push messages to device?

Thanks in Advance

3 Answers3

2

to Get Device ID Use Telephoney U can use it here is it is

public static String deviceUDID(Context ctx) {
    final TelephonyManager tm = (TelephonyManager) ctx.getSystemService(Context.TELEPHONY_SERVICE);

    final String tmDevice, tmSerial, androidId;
    tmDevice = "" + tm.getDeviceId();
    tmSerial = "" + tm.getSimSerialNumber();
    androidId = "" + android.provider.Settings.Secure.getString(ctx.getContentResolver(), android.provider.Settings.Secure.ANDROID_ID);

    UUID deviceUuid = new UUID(androidId.hashCode(), ((long)tmDevice.hashCode() << 32) | tmSerial.hashCode());
    String deviceId = deviceUuid.toString();
    Log.d("Device Id", deviceId);
    return deviceId;
} 
Usman Kurd
  • 7,212
  • 7
  • 57
  • 86
  • Hi Usman ,i will highly appreciate if you could tell me the way the Rhomobile help to get device id? – Sukhi tambar Dec 11 '12 at 12:57
  • @Sukhitambar i have not worked on it but here is a link check this http://osdir.com/ml/rhomobile/2011-08/msg01112.html http://docs.rhomobi.com/rhodes/device-caps http://docs.rhomobi.com/rhodes/device-caps#push-notifications if its worthy for you – Usman Kurd Dec 11 '12 at 13:48
0

to Register Device Using C2DM Please check it here C2DM

Usman Kurd
  • 7,212
  • 7
  • 57
  • 86
0

First of all, is System.get_property('device_id') not System.get('device_id'), this value is going to be empty until GCM has provided an identifier for the device. I am working on this as well. I believe you have to follow these steps:

  • On the build.yml file add:

    capabilities:
    - push
    
  • Add the push callback to your application, to alert the user, whatever you need to do. From my understanding when using Rhomobile you cannot use the simulator for pushing messages, so you have to put it on a device. The device will contact the GCM server that it wants to receive pushed messages from your android application.

If you setup your application package to do this, the GCM server will provide an ID to your device, which in turn you have setup to send this id from your device to your server, to be able to push messages to your application for that device. I still need to figure out a couple of things but that is the process. Good Luck!

Rubens
  • 14,478
  • 11
  • 63
  • 92