提交 271466c5 编写于 作者: 杜庆泉's avatar 杜庆泉

Update utsandroid.md

上级 ed40a51f
...@@ -656,12 +656,19 @@ context.startActivity(intent); ...@@ -656,12 +656,19 @@ context.startActivity(intent);
export function getJavaClassTest() : boolean { export function getJavaClassTest() : boolean {
let dispatcherClass = UTSAndroid.getJavaClass(UTSAndroid.getDispatcher()) let dispatcherClass = UTSAndroid.getJavaClass(UTSAndroid.getDispatcher())
if("io.dcloud.uts.task.UTSTaskDispatcher" == dispatcherClass.name){ 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 return false
} }
``` ```
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册