java - Not allowed to bind to service Intent when starting a service -
i developing android app. when want start service, face problem: not allowed bind service intent. service yotaphone screen service.
i search problem, there little information, of them not same kind of problem. have no idea part goes wrong.
i fellow instructions: http://mwiki.yotaphone.com/wiki/building_first_app.
the onstart() function in mainactivity:
@override protected void onstart() { super.onstart(); intent bsintent = new intent(this, mybsactivity.class); this.startservice(bsintent); } the yotaphone screen service:
public class mybsactivity extends bsactivity { @override protected void onbscreate() { super.onbscreate(); setbscontentview(r.layout.bs_activity); }} the error description:
04-24 18:27:12.659 28763-28763/com.pli.yotaphone2 e/androidruntime﹕ fatal exception: main process: com.pli.yotaphone2, pid: 28763 java.lang.runtimeexception: unable start service com.pli.yotaphone2.mybsactivity@42624840 intent { cmp=com.pli.yotaphone2/.mybsactivity }: java.lang.securityexception: not allowed bind service intent { act=yotaphone.intent.action.get_sdk_binder } @ android.app.activitythread.handleserviceargs(activitythread.java:2735) @ android.app.activitythread.access$2100(activitythread.java:138) @ android.app.activitythread$h.handlemessage(activitythread.java:1296) @ android.os.handler.dispatchmessage(handler.java:102) @ android.os.looper.loop(looper.java:136) @ android.app.activitythread.main(activitythread.java:5061) @ java.lang.reflect.method.invokenative(native method) @ java.lang.reflect.method.invoke(method.java:515) @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:787) @ com.android.internal.os.zygoteinit.main(zygoteinit.java:603) @ dalvik.system.nativestart.main(native method) caused by: java.lang.securityexception: not allowed bind service intent { act=yotaphone.intent.action.get_sdk_binder } @ android.app.contextimpl.bindservicecommon(contextimpl.java:1596) @ android.app.contextimpl.bindservice(contextimpl.java:1560) @ android.content.contextwrapper.bindservice(contextwrapper.java:517) @ com.yotadevices.sdk.bsactivity.dobindservice(bsactivity.java:137) @ com.yotadevices.sdk.bsactivity.onstartcommand(bsactivity.java:173) @ android.app.activitythread.handleserviceargs(activitythread.java:2718)
the androidmanifest.xml:
<?xml version="1.0" encoding="utf-8"?> <application android:allowbackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:theme="@style/apptheme" > <activity android:name=".mainactivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> </intent-filter> </activity> <!-- service working screen --> <service android:name=".mybsactivity" android:exported="true" /> <!-- adding yotaphone sdk library --> <uses-library android:name="com.yotadevices.yotaphone2.sdk.v2" android:required="true" /> </application>
i ran exact same problem, , first thought current system apps didn't yet support new sdk. however, tried decompile existing yota app, , found need include permission. tutorial fails mention.
so fix (our) problem, need include following permission in androidmanifest.xml:
<uses-permission android:name="com.yotadevices.framework.permission.access_backscreen" /> happy coding!
Comments
Post a Comment