java.lang.SecurityException异常:未经允许android.permission.BIND_INPUT_METHOD只为< = 2.2 [英] java.lang.SecurityException: without permission android.permission.BIND_INPUT_METHOD only for <=2.2

查看:1201
本文介绍了java.lang.SecurityException异常:未经允许android.permission.BIND_INPUT_METHOD只为< = 2.2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个非常unpeculiar exception.The件事是我有这样的应用程序,有一个按钮来启动

I have this very unpeculiar exception.The thing is have i have this app that has a button to start

 InputMethodService

启动这样

public class MyGroovyIme extends InputMethodService {

,这是它的外观清单中。

and this is how it looks in manifest.

  <service
        android:name=".MyGroovyIme"
        android:enabled="true"
        android:exported="true"
        android:permission="android.permission.BIND_INPUT_METHOD" >
        <intent-filter>
            <action android:name="android.view.InputMethod" />
            <!-- <category android:name="android.intent.category.DEFAULT" /> -->
        </intent-filter>

        <meta-data
            android:name="android.view.im"
            android:resource="@xml/method" />
    </service>

这就是我如何启动服务

and this is how I start service

  void startServer() {
    Log.v(TAG, "Starting service...");
    Intent serviceIntent = new Intent(this, MyGroovyIme.class);
    startService(serviceIntent);
    Log.v(TAG, "Starting service...success!!!");
    // this.finish();
    Log.v(TAG, "finish called...");
}

整个安装工程就像一个魅力,当我做它在平板电脑(摩托XOOM,其3.2),但是当我这样做的,关于2.2和2.1操作系统的手机(我还没有尝试过在2.3和不能使用模拟器其一)这就是我得到

the whole setup works like a charm when i do it on Tablet(Moto XOOM ,its 3.2) but when I do it on Devices that run on 2.2 and 2.1(i havent tried it on 2.3 and cant use emulator either) this is what i get

 java.lang.SecurityException: Not allowed to start service Intent { cmp=com.spp.ime.demo/.MyGroovyIme } without permission android.permission.BIND_INPUT_METHOD
at android.app.ContextImpl.startService(ContextImpl.java:840)
at android.content.ContextWrapper.startService(ContextWrapper.java:336)
at com.spp.ime.demo.GROOVY_IME_DEMOActivity.startServer(GROOVY_IME_DEMOActivity.java:137)
at com.spp.ime.demo.GROOVY_IME_DEMOActivity.onStartClick(GROOVY_IME_DEMOActivity.java:104)
at com.spp.ime.demo.GROOVY_IME_DEMOActivity.onClick(GROOVY_IME_DEMOActivity.java:67)
at android.view.View.performClick(View.java:2408)
at android.view.View$PerformClick.run(View.java:8816)
at android.os.Handler.handleCallback(Handler.java:587)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4633)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
at dalvik.system.NativeStart.main(Native Method)

我明白了安全问题,但它不应该是相同的所有设备还是我失去了特定的版本和LT的东西; 3.2

I do understand the security concerns but shouldnt it be same for all devices or am i missing something specific to versions <3.2

推荐答案

长的搜索后没有找到一个可靠的答案,仍然没有得到确切的原因..
但经历的新功能,在发现以后的版本中添加的硬件特性可能导致这种宽大的Andr​​oid操作系统。
这里是描述Android的这里主要更新的链接

After a long search have not found a reliable answer and still have not got the exact reason.. but going through the new features have found hardware features that were added at later versions may have led to this leniency in Android OS. Here is the link describing major updates for Android here

这篇关于java.lang.SecurityException异常:未经允许android.permission.BIND_INPUT_METHOD只为&LT; = 2.2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆