我正在尝试将Amazon Device Messaging与
Android Studio集成.首先我跟着(
integrating-your-app-with-adm).当我打电话
ADM adm = new ADM(getActivity()); if (adm.isSupported()) { // ... }
logcat上有这样的输出:
E/AndroidRuntime(24472): java.lang.RuntimeException: Stub!
E/AndroidRuntime(24472): at com.amazon.device.messaging.ADM.(Unknown Source)
所以我跟着亚马逊(Integrating Amazon Libraries with Android Studio),结果相同.
我的AndroidManifest.xml如下所示:
... <uses-permission android:name="de.mypackage.permission.RECEIVE_ADM_MESSAGE" /> <uses-permission android:name="com.amazon.device.messaging.permission.RECEIVE" /> <permission android:name=".permission.RECEIVE_ADM_MESSAGE" android:protectionLevel="signature" /> ... <application android:name=".MyPackageApplication" android:allowBackup="true" android:allowClearUserData="true" android:hardwareAccelerated="false" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme"> ... <service android:name=".service.ADMNotificationService" android:exported="false" /> <amazon:enable-feature android:name="com.amazon.device.messaging" android:required="true" /> <receiver android:name=".service.ADMNotificationService$MessageAlertReceiver" android:permission="com.amazon.device.messaging.permission.SEND"> <intent-filter> <action android:name="com.amazon.device.messaging.intent.REGISTRATION" /> <action android:name="com.amazon.device.messaging.intent.RECEIVE" /> <category android:name="de.mypackage"/> </intent-filter> </receiver> ... </application>
本地build.gradle看起来像这样:
... dependencies { ... provided files('libs/amazon-device-messaging-1.0.1.jar') ... }
愿你有想法吗?