Appium Android – How to handle ‘Install via USB’ pop ups on Xiaomi devices

During Appium Android automation on Xiaomi devices there comes ‘Install Via USB’ popup every time execution is triggered. It can be handled using following steps,

  1. Signup with MI account on device if not already signed up
  2. Settings Screen > Additional Settings > Developer options > Turn off ‘Miui Optimizations’ option > Restart device
  3. Settings Screen > Security > Permissions > Icon at top right corner > Turn On “Install via USB” option
  4. Settings Screen > Additional Settings > Developer options > Turn On/Off “USB Debugging” > Turn On “Install vis USB” option

Trigger execution and pop-up will not come again.