uniapp ios,andriod用户协议和隐私协议
上架各大应用市场要求app 在首次进入时提示隐私协议
uniapp 官方提供了安卓隐私协议(https://ask.dcloud.net.cn/article/36937) ios需要自己去定义,本文将介绍ios,android 自定义 . iOS系统因为系统授权管理比较完善,调用访问涉及到个人隐私信息的接口都会弹出系统授权提示框,并且在提示框上描述应用使用此权限的用途。android我们需要把manifest.json源码视图中 “prompt”: “custom”, 我们在app.vue里面去调用H5+去判断用户是否同意了隐私协议.详情见代码
app.vue页面
// 隐私政策
// #ifdef APP-PLUS
// console.log(plus.runtime.isAgreePrivacy());
if(!plus.runtime.isAgreePrivacy()'){
uni.navigateTo({
url: 'pages/privacy/privacy'
});
}
// #endif
pages/privacy/privacy页面 nvue页面
<template>
<!-- 首页隐私政策 -->
<view>
<!-- 背景图 -->
<image src="../../static/img/xybg.png" :style="`width: ${windowWidth}px;height: ${windowHeight}px;`"></image>
<view class="flex justify-center position-absolute " style="margin-top: 260rpx;" :style="`width: 750rpx;height: ${windowHeight}px;`">
<view class="flex flex-column bg-white rounded-3" style="width: 600rpx;height: 800rpx;">
<view class="flex align-center justify-center border-bottom " style="height: 120rpx;">
<text>用户协议和隐私政策</text>
</view>
<view class="flex-1 my-2">
<text class="text-muted font"> 请你务必审慎阅读、充分理解“用户协议”和“隐私政策”各条,款,包括但不限于:为了更好的向你提供服务,我们需要收集你的设备标识、操作日志等信息用于分析、优化应用性能。你可阅读服务协议和隐私政策了解详细信息。如果你同意,请点击下面按钮开始接受我们的服务。
</text>
</view>
<view class="flex " style="height: 180rpx;">
<view class="flex align-center justify-center flex-1" @click="xieyi('yonghu')"><text class="border px-4 py-2 bg-light rounded-3 font">用户协议</text></view>
<view class="flex align-center justify-center flex-1" @click="xieyi('yinsi')"><text class="border px-4 py-2 bg-light rounded-3 font ">隐私政策</text></view>
</view>
<view class="flex border-top" style="height: 120rpx;">
<view class="flex align-center justify-center flex-1 " @click="quit"><text class="text-muted">退出应用</text></view>
<view class="flex align-center justify-center flex-1 main-bg" @click="submit"><text class="text-white">同意</text></view>
</view>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
windowHeight: 0,
windowWidth: 0
}
},
onLoad() {
const res = uni.getSystemInfoSync();
this.windowWidth = res.windowWidth
this.windowHeight = res.windowHeight
},
methods: {
// 同意隐私
submit(){
plus.runtime.agreePrivacy();
uni.switchTab({
url:"/pages/tabBar/home"
})
},
// 退出应用
quit(){
console.log('aaaaaaa');
plus.runtime.disagreePrivacy();
//android退出应用
plus.runtime.quit();
//ios退出应用
plus.ios.import("UIApplication").sharedApplication().performSelector("exit");
},
xieyi(type){
uni.navigateTo({
url: '../yonghuxieyi/yonghuxieyi?type='+type
});
}
}
}
</script>
<style>
</style>