使用Android应用程序(.apk)安装键盘布局文件(.kl) [英] Installing a keylayout file (.kl) with android app (.apk)

查看:230
本文介绍了使用Android应用程序(.apk)安装键盘布局文件(.kl)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试并搜索了几天,无法为我的问题提出任何解决方案:

i have tried and searched for days and was unable to come up with any solution for my problem:

我正在尝试在/system/usr/keylayout中安装.kl文件,以重新映射我的应用程序的某些键盘键.我有正确格式的正确.kl文件:Vender_XXXX_Product_XXXX.kl,如果我使用root资源管理器将其复制,它将可以正常工作.

I am trying to install a .kl file in /system/usr/keylayout to remap some keyboard keys for my app. I have the proper .kl file in the right format: Vender_XXXX_Product_XXXX.kl and it works if i copy it by using root explorer.

但是我希望通过安装我的应用程序来安装它(没有root).这意味着它必须包含在.apk文件中并在安装过程中复制!!

But I want it to be install (without root) by installing my app. Which means it has to be include in the .apk file and copied during installation!?

到目前为止,我的方法是使用接收器和QUERY_KEYBOARD_LAYOUTS意图. 为此,需要一个.kcm文件.这不适用于我的手机(Galaxy S3).我不知道为什么,但是在settings:(

My approach so far was either with using a receiver and the QUERY_KEYBOARD_LAYOUTS intent. For that a .kcm file is needed. That did not work with my phone (Galaxy S3). I do not know why but it does not show the PHYSICAL_KEYBOARD settings item in settings :(

无论如何,我认为/希望更好的方法是使用NDK: 我尝试使用ndk,并且能够将某些本机c集成到我的应用程序中,但是没有像.kl文件这样的源"文件. 我希望device.mk文件能够以某种方式将我的.kl文件复制到/system中,如下所示: device.mk PRODUCT_COPY_FILES + = $(LOCAL_PATH)/Vendor_XXXX_Product_XXXX.kl:system/usr/keylayout/Vendor_XXXX_Product_XXXX.kl

Anyways i think/hope the better way is by NDK: I tried using the ndk and was able to integrate some native c into my application but no "source" files like my .kl file. I was hoping that a device.mk file would somehow be able to copy my .kl file to /system like so: device.mk PRODUCT_COPY_FILES += $(LOCAL_PATH)/Vendor_XXXX_Product_XXXX.kl:system/usr/keylayout/Vendor_XXXX_Product_XXXX.kl

那完全有可能吗?要使用NDK在安装实际apk时自动将文件安装"到/system? 如果是这样,您该怎么做?我对整个makefile和NDK感到困惑.永远不要使用它,我对c非常不好.

Is that at all possible? To use the NDK to "install" a file to /system automatically while installing the actual apk? And if so how do you do that? I am confused about the whole makefile thing and NDK. Never use that before and I am quite bad with c.

如果你们中有人知道我该怎么做...请让我知道.不胜感激!

If any of you guys know how to do what I am asking ... please let me know. It would be greatly appreciated!

推荐答案

使用apk软件包安装.kcm文件并非没有可能.实际上,这正是布局应用程序的工作方式.您在QUERY_KEYBOARD_LAYOUT的正确轨道上.

It's not impossible to install a .kcm file with an apk package. In fact that is just how layout apps do it. You are on the right track with the QUERY_KEYBOARD_LAYOUT.

我想像您一样安装.kl文件,但是找不到任何好的信息.因此,我只在.kcm文件中使用了map关键字,它具有完全相同的效果.

I wanted to install a .kl file, just like you, but I couldn't find any good info on it. So instead I just used the map keyword in my .kcm file, it has the exact same effect.

在此处查看我的源代码,在这里我允许用户添加se_sv_dvorak布局kcm而不用扎根手机: https: //github.com/innsmouthrain/se_sv_dvorak

Check out my source here, where I allow the user to add the se_sv_dvorak layout kcm without rooting the phone: https://github.com/innsmouthrain/se_sv_dvorak

这篇关于使用Android应用程序(.apk)安装键盘布局文件(.kl)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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