diff --git a/docs/uts/utsandroid.md b/docs/uts/utsandroid.md index f250ffbc810bf5a7939cec77caee6cb018c2b979..e5ccdd295a49b2ca2de8b6e81a6292395f9c8979 100644 --- a/docs/uts/utsandroid.md +++ b/docs/uts/utsandroid.md @@ -656,12 +656,19 @@ context.startActivity(intent); export function getJavaClassTest() : boolean { let dispatcherClass = UTSAndroid.getJavaClass(UTSAndroid.getDispatcher()) if("io.dcloud.uts.task.UTSTaskDispatcher" == dispatcherClass.name){ - return true + return true + } + let applicationClass = UTSAndroid.getJavaClass(UTSAndroid.getAppContext()!) + if("io.dcloud.uniapp.UniApplication" == applicationClass.name){ + return true + } + /** + * 特殊用法:UTSAndroid.getJavaClass(XXX) 可以传入类而不是实例,这样会被编译成 XXX::class.java + */ + let utsAndroidClass = UTSAndroid.getJavaClass(UTSAndroid) + if("io.dcloud.uts.UTSAndroid" == utsAndroidClass.name){ + return true } - let applicationClass = UTSAndroid.getJavaClass(UTSAndroid.getAppContext()!) - if("io.dcloud.uniapp.UniApplication" == applicationClass.name){ - return true - } return false } ```