question

ran-mor avatar image
ran-mor asked

INVALID_SENDER

Hi, i'm trying to register to the ADM service. after i call the method adm.startRegister(); i can see (in debug mode) that the function onRegistrationError(String s) (from the MyADMMessageHandler class) being called while "s" value is: "INVALID_SENDER". i dont get any error message in the log concerning the registration. i have the api_key.txt file in the assets folder. i've implemented all the classes according to the "Integrating Your App with ADM" guide. the only error i get in the log is : " Service com.amazon.device.messaging.PrivateADMRegistrationService has leaked ServiceConnection com.amazon.identity.auth.device.authorization.api.AmazonCredentialManager$CredentialManagerServiceConnection@419544b8 that was originally bound here android.app.ServiceConnectionLeaked: Service com.amazon.device.messaging.PrivateADMRegistrationService has leaked ServiceConnection com.amazon.identity.auth.device.authorization.api.AmazonCredentialManager$CredentialManagerServiceConnection@419544b8 that was originally bound here at android.app.LoadedApk$ServiceDispatcher. (LoadedApk.java:1024) at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:918) at android.app.ContextImpl.bindService(ContextImpl.java:1156) at android.content.ContextWrapper.bindService(ContextWrapper.java:387) at com.amazon.identity.auth.device.authorization.api.AmazonCredentialManager.synBindService(AmazonCredentialManager.java:409) at com.amazon.identity.auth.device.authorization.api.AmazonCredentialManager.access$2(AmazonCredentialManager.java:375) at com.amazon.identity.auth.device.authorization.api.AmazonCredentialManager$BindAndDoTask.doInBackground(AmazonCredentialManager.java:527) at com.amazon.identity.auth.device.authorization.api.AmazonCredentialManager$BindAndDoTask.doInBackground(AmazonCredentialManager.java:1) at com.amazon.identity.auth.device.authorization.api.AbstractCredentialManagerAsyncTask.doInBackground(AbstractCredentialManagerAsyncTask.java:1) at android.os.AsyncTask$2.call(AsyncTask.java:264) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305) at java.util.concurrent.FutureTask.run(FutureTask.java:137) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569) at java.lang.Thread.run(Thread.java:856) " Can anyone tell me why i get this "invalid_Sender" error and how can i fix it? thanks, ran
amazon device messaging
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

julesanchez avatar image
julesanchez answered
Did you generate your api key on developer console, and putt it to file assets/api_key.txt of your project ?
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

ran-mor avatar image
ran-mor answered
Thanks for the reply. Yep i did that. but still i get the invalid_sender message
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Sujoy@Amazon avatar image
Sujoy@Amazon answered
Hi Ran, Thank you for posting. In order to activate adm service in your app, you need to create a security profile and generate api key for that profile, and this api key you are supposed to save in api_key.txt file in assets folder of your project. INVALID_SENDER can be received during ADM registration due to couple of reasons. 1. To generate an api key you are supposed to enter the package name and the MD5 signature of the certificate you are using to sign your app. If these values are wrong, you would get a wrong key and that would cause INVALID_SENDER in run time. Please make sure the package name and the md5 finger print of the app signing certificate are correct. 2. ADM cannot recognize your API Key if it contains any spaces or line breaks (please refer https://developer.amazon.com/sdk/adm/integrating-app.html#Asset). Could you please check your api_key.txt once? If the problem exists still, I would request you to raise a ContactUs ( https://developer.amazon.com/help/contactus.html) with the app details, so that one of our support engineers can assist you to resolve the issue. Please mention this thread url ( https://forums.developer.amazon.com/forums/thread.jspa?threadID=1195&tstart=0) in the ContactUs case.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

ran-mor avatar image
ran-mor answered
Hi, Thank you for the answer. i have another question that (i think) can help resolve the problem. I'm using Intellij IDE. when i'm running my project from the Intellij (on an actual device) i suppose that the debug.keystore from the .android folder being used. i'm not sure that i'm using the right "alias of the certificate within the keystore" when i'm generating the MD5. does anyone know what the alias name is? i've tried to find it online but found no answer. In other words: i think i'm not using the right debug.keystore file and alias, and i cant find the right files and alias name to use when running a project directly from in Intellij. Does anyone know? Thanks, Ran
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Sujoy@Amazon avatar image
Sujoy@Amazon answered
Hi Ran-mor, Nice to hear you again. The alias of default debug.keystore is "androiddebugkey" and storepass is "android". This keystore file generated by android sdk and is used by all IDEs (including intellij IDEA). I am also a fan of intellij and there you have option to customize the signing of your apk. You can find (at least in version 12.x.x) "Generate Signed APK" in "Build" menu and you can enter key store path, alias and password there to sign your build with a custom keystore. Thanks
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

ran-mor avatar image
ran-mor answered
Thanks Sujoy! Its working :)) i have another questio please, is there any way to include the adm jar file inside my project as an internal jar? i've tried but i got either the "stub" error (when i put the jar inside my library project and export it) or , when i put the jar in my project lib folder, all android devices are recognize as kindle devices: mAmazonMapsAvailable always true at : " mAmazonMapsAvailable = false ; try { Class.forName( "com.amazon.geo.maps.MapView" ); mAmazonMapsAvailable = true ; } catch (Exception e) { e.printStackTrace(); } " thanks !!
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Sujoy@Amazon avatar image
Sujoy@Amazon answered
Hi Ran-mor, Thank you for posting. adm.jar should be added to your project as external jar so that the dependency is included in the classpath only at the compilation phase and not in run time. To achieve that in intellij idea, you have to go "Project Structure" (Ctl+Alt+Shift+S) - > Modules -> Dependencies. Add adm jar by clicking "+" button (green in color) in the right (Alt + Insert) bar, after that you should select the scope as "Provided" for adm.jar. That's it. Make sure "Export" check box is not selected for this jar. Now go for build and your app should run fine.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

ran-mor avatar image
ran-mor answered
Thanks :)
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

ran-mor avatar image
ran-mor answered
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

amazongangadhar avatar image
amazongangadhar answered
Hi Sujoy, I am also getting same error after i downloaded the sample app( snsmobilepush.zip) from [u] http://docs.aws.amazon.com/sns/latest/dg/mobile-push-adm.html#api-key-adm[/u] [b]My Logs are[/b] 08-13 18:17:31.509: I/KindleMobilePushApp(5923): model: KFTT 08-13 18:17:31.798: D/libEGL(5923): loaded /system/lib/egl/ libGLES_android.so 08-13 18:17:31.798: D/libEGL(5923): loaded /vendor/lib/egl/ libEGL_POWERVR_SGX540_120.so 08-13 18:17:31.814: D/libEGL(5923): loaded /vendor/lib/egl/ libGLESv1_CM_POWERVR_SGX540_120.so 08-13 18:17:31.814: D/libEGL(5923): loaded /vendor/lib/egl/ libGLESv2_POWERVR_SGX540_120.so 08-13 18:17:32.001: D/OpenGLRenderer(5923): Enabling debug mode 0 08-13 18:17:32.735: E/onRegistrationError(5923): INVALID_SENDER to use ADM, are below things necessary ? 1. Do we need publish the app in Amazon App Store ([u] https://developer.amazon.com/myapps.html[/u])? 2. Is it necessary Server side implementation for testing ? 3. Is it necessary to create api_key.txt in Assets folder ?[b][/b] Message was edited by: amazongangadhar
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.