• 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?

[GALLERY=media, 550]SettingIcon_click by Ravindra Pal Singh posted Jun 2, 2020 at 9:35 PM[/GALLERY]

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


[GALLERY=media, 551]WhatsApp Image 2020-06-02 At 6.24.10 PM by Ravindra Pal Singh posted Jun 2, 2020 at 9:35 PM[/GALLERY]
 
Back
Top Bottom