Android开发:当手机应用程序活动集中时,在键盘上挂上快捷键
这是一个具体的问题,我以前做过一些Android开发,但对系统管理没有深入的了解 因此,我需要创建一个在后台运行的应用程序(这部分没问题),并在从手机上的手机应用程序软件键盘键入特殊快捷键(比如#123*6)时自动启动应用程序的活动Android开发:当手机应用程序活动集中时,在键盘上挂上快捷键,android,keyboard-shortcuts,android-softkeyboard,Android,Keyboard Shortcuts,Android Softkeyboard,这是一个具体的问题,我以前做过一些Android开发,但对系统管理没有深入的了解 因此,我需要创建一个在后台运行的应用程序(这部分没问题),并在从手机上的手机应用程序软件键盘键入特殊快捷键(比如#123*6)时自动启动应用程序的活动 您能告诉我这是否可能,如果可以,我应该使用什么API/组件吗?在Web上找不到相关内容。好的,我终于在HTC设备上实现了这一点。事实上,三星手机似乎对密码没有反应 我只是有这张清单: <uses-permission android:name="android
您能告诉我这是否可能,如果可以,我应该使用什么API/组件吗?在Web上找不到相关内容。好的,我终于在HTC设备上实现了这一点。事实上,三星手机似乎对密码没有反应 我只是有这张清单:
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.PROCESS_OUTGOING_CALLS" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MenuBrowser"
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
android:name=".ShortcodeService"
android:exported="false">
</service>
<receiver
android:name=".ShortcodeReceiver"
android:enabled="true">
<intent-filter>
<action android:name="android.provider.Telephony.SECRET_CODE" />
<data android:scheme="android_secret_code" android:host="1992" />
</intent-filter>
</receiver>
</application>
我的接收器是这样的:
public class ShortcodeReceiver extends BroadcastReceiver {
private static String defaultCode = "1992";
@Override
public void onReceive(Context context, Intent intent) {
Log.d("USSDBrowser", "Intent received");
if(intent.getAction().equals("android.provider.Telephony.SECRET_CODE")) {
String code = intent.getDataString();
if(code.equals("android_secret_code://" + defaultCode)) {
Log.d("USSDBrowser", "Code received !!! ");
}
//Intent in = new Intent(context, MenuBrowser.class);
//context.startActivity(in);
Toast.makeText(context, "You typed a shortcode, hype !", Toast.LENGTH_LONG).show();
}
}
}
但现在我已经测试过了,它已经在HTC One s(安卓4.1.1)和Aquaris E4(安卓4.4.2)上运行
测试过的未捕获密码意图的手机有:三星Galaxy S4和Galaxy S6(Android 6.0)。我知道输入设备存在很多安全问题,但密码管理器使用的可访问性功能存在很多不安全问题。查看更多信息。多亏了这个问题,我也要检查一下。我在页面上看到一个查看文本更改事件,它可以响应
EditText
(不是密码框tho)中的更改。虽然不完全是你所要求的,但它可能会有所帮助。根据“为什么”,你可能会发现一般的手势听者也很有用。我发现这些主题满足了我的需求,伙计们:和。然而,我没有设法获得启动活动的密码。不,绝对没有:(在HTC One S和三星Galaxy S6上,我没有设法让它工作。我还检查了这些主题:&。还有这一个。即使我有正确的授权,广播接收器也不会被调用。。。
public class ShortcodeReceiver extends BroadcastReceiver {
private static String defaultCode = "1992";
@Override
public void onReceive(Context context, Intent intent) {
Log.d("USSDBrowser", "Intent received");
if(intent.getAction().equals("android.provider.Telephony.SECRET_CODE")) {
String code = intent.getDataString();
if(code.equals("android_secret_code://" + defaultCode)) {
Log.d("USSDBrowser", "Code received !!! ");
}
//Intent in = new Intent(context, MenuBrowser.class);
//context.startActivity(in);
Toast.makeText(context, "You typed a shortcode, hype !", Toast.LENGTH_LONG).show();
}
}
}