In our last article, We discussed about powering your android application with Android Push Notification (c2dm) which should help any ecommerce or social networking business to send promotional offers to their end users. During implementation some developers might have faced issues like SERVICE_NOT_AVAILABLE while getting the registrationId from the android app or Issue like HTTP/1.1 401 Unauthorized while sending android push notification to the C2DM google service and looking for handle unauthorized HTTP/1.1 401. So here is our checklist to handle these type of errors:
Handle Unauthorized HTTP/1.1 401 and SERVICE_NOT_AVAILABLE Error:
- Your “Role account email *” should be your google email account
- Make sure your “Role account email *” was properly filed in the signup form
- Setup your “Role account email *” in the emulator account once. This is not documented in the c2dm documentation but it worked like magic to get rid the error HTTP/1.1 401 Unauthorized
- In case you have setup you domain with google app (we enjoy google email and other services for our domain) then use option “GOOGLE_OR_HOSTED” OR “HOSTED” while generating Auth code.
We hope using this checklist, you should be able to get rid of the error for android push notification (c2dm). Please feel free to send us your thoughts or questions.