我无法从键盘启动 Activity,而其他键盘(如“Go Keyboard”、“Microsoft Swiftkey Keyboard”、“1C Big Keyboard”和更多键盘在 MIUI 11 上正常工作,默认权限已在安装时允许)在任何中国手机上。
final Intent intent = new Intent( mRichImm.getInputMethodInfoOfThisIme().getSettingsActivity());
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
| Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED
| Intent.FLAG_ACTIVITY_CLEAR_TOP);
intent.addCategory(Intent.CATEGORY_LAUNCHER);
final int currentDisplayId = ((WindowManager) getSystemService(Context.WINDOW_SERVICE))
.getDefaultDisplay().getDisplayId();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
context.startActivity(intent,
ActivityOptions.makeBasic().setLaunchDisplayId(currentDisplayId).toBundle());
}else{
context.startActivity(intent);
}
}else{
context.startActivity(intent);
}