首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >IBM MobileFirst -原生安卓应用程序添加推送清单权限

问IBM MobileFirst -原生安卓应用程序添加推送清单权限
EN

Stack Overflow用户
提问于 2015-07-26 12:02:46
回答 1查看 322关注 0票数 0

我对在这里找到的IBM推送通知的权限部分感到困惑。(第5条)

https://developer.ibm.com/mobilefirstplatform/documentation/getting-started-7-0/notifications/push-notification-native-android-applications/

我已经逐字添加了所有这些权限,但我收到一个错误,说我没有添加清单权限。是否需要修改这些权限中的包名?

这个练习是内置的吗?

代码语言:javascript
复制
<activity
android:name="com.worklight.androidnativepush.AndroidNativePush"
android:label="@string/app_name"
android:theme="@android:style/Theme.Black.NoTitleBar"
android:launchMode="singleTask">

下面是错误日志

代码语言:javascript
复制
07-25 23:24:48.285  17146-17146/? E/AndroidRuntime﹕ FATAL EXCEPTION: main 
Process: com.companyname.hitch.mobilefirsttestapp, PID: 17146 
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.companyname.hitch.mobilefirsttestapp/com.companyname.hitch.mobilefirsttestapp.push.PushActivity}: java.lang.RuntimeException: Your manifest is not allowed to work with push. Android Manifest Error: Missing permission in manifest: com.companyname.hitch.mobilefirsttestapp.permission.C2D_MESSAGE 
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2184) 
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233) 
        at android.app.ActivityThread.access$800(ActivityThread.java:135) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196) 
        at android.os.Handler.dispatchMessage(Handler.java:102) 
        at android.os.Looper.loop(Looper.java:136) 
        at android.app.ActivityThread.main(ActivityThread.java:5001) 
        at java.lang.reflect.Method.invokeNative(Native Method) 
        at java.lang.reflect.Method.invoke(Method.java:515) 
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601) 
        at dalvik.system.NativeStart.main(Native Method) 
 Caused by: java.lang.RuntimeException: Your manifest is not allowed to work with push. Android Manifest Error: Missing permission in manifest: com.companyname.hitch.mobilefirsttestapp.permission.C2D_MESSAGE 
        at com.worklight.wlclient.api.WLPush.<init>(WLPush.java:180) 
        at com.worklight.wlclient.api.WLClient.getPush(WLClient.java:957) 
        at com.companyname.hitch.mobilefirsttestapp.push.PushActivity.onCreate(PushActivity.java:19) 
        at android.app.Activity.performCreate(Activity.java:5231) 
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087) 
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2148) 
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233) 
        at android.app.ActivityThread.access$800(ActivityThread.java:135) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196) 
        at android.os.Handler.dispatchMessage(Handler.java:102) 
        at android.os.Looper.loop(Looper.java:136) 
        at android.app.ActivityThread.main(ActivityThread.java:5001) 
        at java.lang.reflect.Method.invokeNative(Native Method) 
        at java.lang.reflect.Method.invoke(Method.java:515) 
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601) 
        at dalvik.system.NativeStart.main(Native Method) 
EN

回答 1

Stack Overflow用户

发布于 2015-07-26 12:18:24

当使用安卓环境创建基于MobileFirst的混合应用程序时,MobileFirst将基于具有一组预定义权限和活动的模板来创建它。

在本机应用程序中,您是创建它的人。MobileFirst只提供了SDK和一套集成说明。

您在问题中提到的活动(取自教程页面)是教程中包含的示例应用程序的活动。在你自己的应用程序的AndroidManifest.xml中,你会看到你的应用程序的名称,而不是"androidnativepush“(或者更确切地说,需要创建它)。

确保不要在任何地方使用"androidnativepush“,除非这是你的应用程序名称。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/31633502

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档