Files
ctms-client/uni_modules/uts-openSchema/utssdk/app-android/index.uts
fm453 c62d15b288 首次完整推送,
V:1.20240808.006
2024-08-13 18:32:37 +08:00

16 lines
510 B
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import Intent from 'android.content.Intent'
import Uri from 'android.net.Uri'
import { OpenSchema } from '../interface.uts'
export const openSchema: OpenSchema = function (url: string) {
if (typeof url === 'string' && url.length > 0) {
const context = UTSAndroid.getUniActivity()!
const uri = Uri.parse(url)
const intent = new Intent(Intent.ACTION_VIEW, uri)
intent.setData(uri)
context.startActivity(intent)
} else {
console.error('url param ERROR', JSON.stringify(url))
}
}