<template>
	<view>
		<button class="button" @click="openSchema('https://uniapp.dcloud.io/uni-app-x')">使用外部浏览器打开指定URL</button>
		<button class="button" @click="openSchema('market://details?id=com.tencent.mm')">使用应用商店打开指定App</button>
		<button class="button" @click="openSchema('androidamap://viewMap?sourceApplication=Hello%20uni-app&poiname=DCloud&lat=39.9631018208&lon=116.3406135236&dev=0')">打开地图坐标</button>
	</view>
</template>

<script>
import Intent from 'android.content.Intent';
import Uri from 'android.net.Uri';

	export default {
		data() {
			return {

			}
		},
		methods: {
			openSchema(url:string) {
				const context = UTSAndroid.getUniActivity()!;
				const uri = Uri.parse(url)
				const intent = new Intent(Intent.ACTION_VIEW, uri)
				intent.setData(uri);
				context.startActivity(intent);
			}
		}
	}
</script>

<style>
.button {
	margin: 30rpx;
}
</style>
