google cloud messaging - Error on getErrorCodeName() in android code using GCM -
how rectify error "the method geterrorcodename() undefined type multicastresult" ? used following code
multicastresult result = sender.send(message, androidtargets, 1); if (result.getresults() != null) { int canonicalregid = result.getcanonicalids(); if (canonicalregid != 0) { // same device has more on registration id: update database } } else { int error = result.getfailure(); system.out.println("broadcast failure: " + error); string error_code_name = result.geterrorcodename(); //error here if (error_code_name.equals(constants.error_not_registered)) { // application has been removed device - unregister database or remove database } }
thanks in advance !
you want this:
result.getresults().get(0).geterrorcodename();
or like:
for(result r : result.getresults()){ if (constants.error_not_registered.equals(r)) { // application has been removed device - unregister database or remove database } }
api docs:
http://developer.android.com/reference/com/google/android/gcm/server/multicastresult.html http://developer.android.com/reference/com/google/android/gcm/server/result.html
Comments
Post a Comment