I\'m trying the sample code from here. But my app is crashing.
I added logging and found out that it\'s crashing at session.flush(); so I removed that l
This is not Secure.ANDROID_ID, it's Gtalk service device ID.
You can use the following code:
public String getDeviceId(Context context) {
String[] params = { GSERVICES_ID_KEY };
Cursor c = context.getContentResolver()
.query(GSERVICES_URI, null, null, params, null);
if (!c.moveToFirst() || c.getColumnCount() < 2)
return null;
try {
return Long.toHexString(Long.parseLong(c.getString(1))).toUpperCase();
} catch (NumberFormatException e) {
return null;
}
}
And add the permission to read Gservice