# UTSAndroid ## 静态方法 ### onAppConfigChange(callback) ### offAppConfigChange(callback?) ### onAppTrimMemory(callback?) ### offAppTrimMemory(callback?) ### onAppActivityPause(callback) ### offAppActivityPause(callback?) ### onAppActivityResume(callback) ### offAppActivityResume(callback?) ### onAppActivityDestroy(callback) ### offAppActivityDestroy(callback?) ### onAppActivityResult(callback) ### offAppActivityResult(callback?) ### onAppActivityBack(callback) ### offAppActivityBack(callback?) ### getAppContext() ### getUniActivity() ### getResourcePath(resourceName) ### exit() ### getDispatcher(threadName) ```uts // 不传任何参数,得到是当前代码运行线程 let currentDispatcher = UTSAndroid.getDispatcher() console.log("currentDispatcher",currentDispatcher) // 期望在 io 任务队列执行 UTSAndroid.getDispatcher("io").async(function(_){ console.log("当前任务执行在",Thread.currentThread().getName()) // 期望在 主线程 任务队列执行 UTSAndroid.getDispatcher("main").async(function(_){ console.log("当前任务执行在",Thread.currentThread().getName()) currentDispatcher.async(function(_){ console.log("起始任务执行在",Thread.currentThread().getName()) },null) },null) },null) ``` ### getAppId() ### getOsTheme() ### isUniMp() ### getAppName() ### getAppVersion() ### getInnerVersion() ### isUniAppX() ### getAppCachePath ### rpx2px(rpx:number) : number; ### devicePX2px(devicePX:number) : number; ### isPrivacyAgree() : boolean; ### setPrivacyAgree(state:boolean):void; ### resetPrivacyAgree():void; ### requestSystemPermission ### checkSystemPermissionGranted ### gotoSystemPermissionActivity ### getSystemPermissionDenied ### convert2AbsFullPath ### getFileProviderUri ```ts // 使用外部应用打开项目内置图片资源 let file = new File(UTSAndroid.getResourcePath("static/logo.png")) const uri = UTSAndroid.getFileProviderUri(file) const intent = new Intent(Intent.ACTION_VIEW, uri) intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) const context = UTSAndroid.getUniActivity()!; context.startActivity(intent); ```