• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

ROMs How to start Activity from Android Keyboard (IME) on MIUI 11 without asking permission from user?


I am not able to start Activity from keyboard, while other keyboard like "Go Keyboard", "Microsoft Swiftkey Keyboard" , "1C Big Keyboard", and many more keyboard working fine on MIUI 11 with default permission which are already allowed when install in on any Chinese phone.

Java:
    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);
}


 

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones