question

JJOOp avatar image
JJOOp asked ·

ADM registration doesn't work when the package name is changed

Hi, We need to make different flavours out of our app and each one has a different package name. For convenience, we use the aapt's built-in functionality of "--rename-manifest-package" ( http://www.piwai.info/renaming-android-manifest-package/) and everything is working except for ADM. After ADM.startRegister() is called, our ADMMessageHandler subclass callbacks are not being called. It seems like the library can't find it internally and then silently swallows the response. Is there anything we can do about it besides changing the package name everywhere? Thanks.
amazon device messaging
10 |2000 characters needed characters left characters exceeded

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 Pin-sho, You need to crate API keys for all the packages what are using the same security profile. To create an API Key, you must provide both the package name (for example, com.mycompany.bestapplication) for the app and its signature in the same security profile. Please refer below documentation for better understanding. Thanks. https://developer.amazon.com/public/apis/engage/device-messaging/tech-docs/02-obtaining-adm-credentials
10 |2000 characters needed characters left characters exceeded

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

JJOOp avatar image
JJOOp answered ·
Hi, I've verified that we've performed all the steps and I can't see what we're doing wrong. We created another app, we created a new security profile for it and also created new API keys. The thing is that after calling ADM.startRegister(), nothing else happens, not even onRegistrationError is called. Are you sure there's no issue with the package name being changed through aapt? Maybe internally you're trying to find the receiver through reflection and you get the package name from the package manager? Because in that case it won't work, as the package returned by the package manager will be the renamed package, but the receiver is still in the old package.
10 |2000 characters needed characters left characters exceeded

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

JJOOp avatar image
JJOOp answered ·
I forgot to mention that in the version without the package name changed, the registration works as expected. Note that the different versions don't share API keys nor security profiles. Our build process automatically selects the API key needed depending on the version we're building.
10 |2000 characters needed characters left characters exceeded

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

JJOOp avatar image
JJOOp answered ·
Sorted the problem out. I had to manually change the package name of the RECEIVE_ADM_MESSAGE permissions and the package of the intent filter category of the alert receiver. For some reason this change wasn't necessary for GCM but it is for ADM. Thanks anyway!
10 |2000 characters needed characters left characters exceeded

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 ·
Thanks for sharing the details.
10 |2000 characters needed characters left characters exceeded

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