How to find out the application both (Browser and native app)'s page is instrumented or not by using code

Hi ,

How to find out the application both (Browser and native app)'s page is instrumented or not by using code, Because i have settled InstrumentApp=true in Capabilities, It is working fine. But some pages are taking too much time to change its view to instrumented=true mode, So i have to make my appium driver to wait for that much time before i try to Find a Element.

Can you plz tell me how to get know the current running page is whether instrumented or not by using any command or code???

Thanks in advance!
Elango

you can run the command

Set<String> contextHandlers1 = driver.getContextHandles();

if you have the “NATIVE_APP_INSTRUMENTED” context, it means you are working with instrumentation