I'm integrating Amazon device messaging into my app following this Offical docs. According to the docs, I have to create a class (MyADMMessageHandler.java) that extends ADMMessageHandlerJobBase and declare my class as a Service in AndroidManifest.xml
AndroidManifest.xml
<service android:name=".pn.MyADMMessageHandler"
android:exported="false"
android:permission="android.permission.BIND_JOB_SERVICE"/>
But when I built my app, I got this error
AndroidManifest.xml:153: Error: MyADMMessageHandler must extend android.app.Service [Instantiatable]
<service android:name=".pn.MyADMMessageHandler"
Explanation for issues of type "Instantiatable":
Activities, services, broadcast receivers etc. registered in the manifest
file (or for custom views, in a layout file) must be "instantiatable" by
the system, which means that the class must be public, it must have an
empty public constructor, and if it's an inner class, it must be a static
inner class.
1 errors, 0 warnings
BUILD SUCCESSFUL in 18s
Despite of this error, I still had BUILD SUCCESSFUL. I decompiled amazon-device-messaging-1.1.0.jar to see what's going on, but it just contains stub implementation and ADMMessageHandlerJobBase doesn't extends Service or any subclass of Service.
So MyADMMessageHandler class isn't a Service but why do we need to declare it as a Service in AndroidManifest.xml?
Note: In the sample code of Amazon device messaging, it also did the same.
Update 1
I've also asked here, and received the answer:
If you are following this 1 documentation then you should be fine. The error you see should just be a warning and can be ignored. The declaration in AndroidManifest.xml is a must.
ADMMessageHandlerJobBase
– Yoko