更新记录
1.0.2(2025-06-16)
- 修复已知问题
1.0.1(2025-06-14)
- 修复一直问题
1.0.0(2025-06-14)
- 新版
平台兼容性
uni-app(4.36)
| Vue2 | Vue3 | Chrome | Safari | app-vue | app-nvue | Android | iOS | 鸿蒙 | 
|---|---|---|---|---|---|---|---|---|
| √ | √ | - | - | - | - | 5.0 | 12 | × | 
| 微信小程序 | 支付宝小程序 | 抖音小程序 | 百度小程序 | 快手小程序 | 京东小程序 | 鸿蒙元服务 | QQ小程序 | 飞书小程序 | 快应用-华为 | 快应用-联盟 | 
|---|---|---|---|---|---|---|---|---|---|---|
| × | × | × | × | × | × | - | × | × | × | × | 
uni-app x(4.36)
| Chrome | Safari | Android | iOS | 鸿蒙 | 微信小程序 | 
|---|---|---|---|---|---|
| - | - | 5.0 | 12 | × | × | 
aries-nativelocation
开发文档
UTS 语法 UTS API插件 UTS uni-app兼容模式组件 UTS 标准模式组件 Hello UTS
特别提醒
- 购买本插件前,请先试用、请先试用、请先试用,并充分自测确认满足需求之后再行购买。购买之后无法退款;
- 如有使用上的疑问、bug,可以进交流群联系作者;
- 结合文档和示例代码集成使用;
- 试用必须先打基座、试用必须先打基座、试用必须先打基座重要事情说三遍;
插件功能介绍 (支持uni-app/uni-app-x)
- 定位、连续定位、后台定位(Android需要使用保活定位)
- 保活定位
- 坐标转换
Android后台采集或保活设置
- 
通知管理允许通知,允许自启动; 
- 
耗电保护允许后台运行; 
- 
电池设置中关闭智能耗电保护、省电模式、应用速冻等。 
注意事项:
- 本插件使用需要打自定义基座调试、试用。
- Android手机型号太多,各品牌对手机的限制不尽相同,需要保活而进行的设置也不一样。随着Android系统的更新迭代,保活的难度也在不断加大。最有效的保活方式还是联系厂家添加白名单以实现进程保活。
- 定位返回WGS84坐标
- android修改通知栏的图标只需替换uni_modules/aries-nativelocation/utssdk/app-android/res/drawable/logo.png图标,替换的图标名称不能修改必须是logo.png,替换完需要重新打基座/包才能生效
集成文档
import * as Location from "@/uni_modules/aries-nativelocation"
接口说明
- 基础配置 configureBasicConfiguration 在定位前调用
Location.configureBasicConfiguration({
  onceLocationTimeout: 5000, //单次定位超时时间
  locationInterval: 4000, //连续定位、保活定位间隔
  notificationTitle: "App后台定位中",//Android 通知标题
  notificationContentText: "后台定位" //Android通知内容
})- 单次定位
Location.onceLocation({
        locationResultBackcall: (res) => {
            if (res.code == 200) {
                uni.showToast({
                    icon: 'none',
                    title: `定位成功--精度:${res.location?.longitude}----纬度:${res.location?.latitude}`
                })
            } else {
                uni.showToast({
                    icon: "none",
                    title: `${res.mes}`
                })
            }
        }
});- 连续定位
Location.startUpdatingLocation({
                    enableBackgroundLocation: false,//是否后台定位,iOS端enableBackgroundLocation=true表示保活定位,Android保活定位需调用保活接口(keepLiveLocation)
                    locationResultBackcall: (res) => {
                        if (res.code == 200) {
                            uni.showToast({
                                icon: 'none',
                                title: `定位次数:${this.locationCount}精度:${res.location?.longitude}----纬度:${res.location?.latitude}`
                            })
                        } else {
                            uni.showToast({
                                icon: "none",
                                title: `${res.mes}`
                            })
                        }
                    }
                })- 停止连续定位
Location.stopUpdatingLocation()- 保活定位 -仅Android有效
Location.keepLiveLocation({
                    locationResultBackcall: (res) => {
                        if (res.code == 200) {
                            uni.showToast({
                                icon: 'none',
                                title: `定位次数:${this.locationCount}精度:${res.location?.longitude}----纬度:${res.location?.latitude}`
                            })
                        } else {
                            uni.showToast({
                                icon: "none",
                                title: `${res.mes}`
                            })
                        }
                    }
                })- 关闭保活
Location.offKeepLiveLocation()uniapp 示例代码
<template>
    <view class="content">
        <view class="header">
            <view class="btn" @click="onceLocationAction()">单次定位</view>
            <view class="btn" @click="startUpdatingLocationAction()">连续定位</view>
            <view class="btn" @click="keepAliveAction()">保活定位</view>
        </view>
        <view class="header">
            <view class="btn" @click="stopUpdatingLocationAction()">停止连续定位</view>
            <view class="btn" @click="nonKeepAliveAction()">停止保活</view>
        </view>
    </view>
</template>
<script>
    import * as Location from "@/uni_modules/aries-nativelocation"
    export default {
        data() {
            return {
                locationCount: 0
            }
        },
        onLoad() {
            Location.configureBasicConfiguration({
                onceLocationTimeout: 5000,//单次定位超时时间,可选参数仅Android有效
                locationInterval: 4000,//连续定位、保活定位间隔 可选参数默认10秒
                notificationTitle: "App后台定位中",//保活前台通知栏 标题、仅Android有效
                notificationContentText: "正在后台定位"//保活前台通知栏 内容、仅Android有效
            })
        },
        methods: {
            onceLocationAction() {
                Location.onceLocation({
                    locationResultBackcall: (res) => {
                        if (res.code == 200) {
                            this.locationCount++;
                            uni.showToast({
                                icon: 'none',
                                title: `定位成功--精度:${res.location?.longitude}----纬度:${res.location?.latitude}`
                            })
                        } else {
                            uni.showToast({
                                icon: "none",
                                title: res.mes
                            })
                        }
                    }
                });
            },
            //连续定位
            startUpdatingLocationAction() {
                Location.startUpdatingLocation({
                    enableBackgroundLocation: false,
                    locationResultBackcall: (res) => {
                        if (res.code == 200) {
                            this.locationCount++;
                            uni.showToast({
                                icon: 'none',
                                title: `定位次数:${this.locationCount}精度:${res.location?.longitude}----纬度:${res.location?.latitude}`
                            })
                        } else {
                            uni.showToast({
                                icon: "none",
                                title: res.mes
                            })
                        }
                    }
                })
            },
            //停止连续定位
            stopUpdatingLocationAction() {
                this.locationCount = 0
                Location.stopUpdatingLocation()
            },
            //保活
            keepAliveAction() {
                Location.keepLiveLocation({
                    locationResultBackcall: (res) => {
                        console.log('1111111111111')
                        if (res.code == 200) {
                            this.locationCount++;
                            uni.showToast({
                                icon: 'none',
                                title: `定位次数:${this.locationCount}精度:${res.location?.longitude}----纬度:${res.location?.latitude}`
                            })
                        } else {
                            uni.showToast({
                                icon: "none",
                                title: res.mes
                            })
                        }
                    }
                })
            },
            //停止保活
            nonKeepAliveAction() {
                this.locationCount = 0
                Location.offKeepLiveLocation()
            }
        }
    }
</script>
<style>
    .content {
        width: 750rpx;
        display: flex;
        height: 100%;
        flex-direction: column;
    }
    .header {
        width: 750rpx;
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        padding: 0 10rpx;
        margin-top: 40rpx;
        box-sizing: border-box;
    }
    .btn {
        display: flex;
        height: 80rpx;
        flex: 1;
        align-items: center;
        justify-content: center;
        background-color: cadetblue;
        color: white;
        margin-right: 10rpx;
        font-size: 28rpx;
    }
</style>    uni-app-x示例代码
<template>
    <view class="content">
        <view class="header">
            <view class="btn" @click="onceLocationAction()">单次定位</view>
            <view class="btn" @click="startUpdatingLocationAction()">连续定位</view>
            <view class="btn" @click="keepAliveAction()">保活定位</view>
        </view>
        <view class="header">
            <view class="btn" @click="stopUpdatingLocationAction()">停止连续定位</view>
            <view class="btn" @click="nonKeepAliveAction()">停止保活</view>
        </view>
    </view>
</template>
<script>
    import * as Location from "@/uni_modules/aries-nativelocation"
    export default {
        data() {
            return {
                locationCount: 0
            }
        },
        onLoad() {
            Location.configureBasicConfiguration({
                onceLocationTimeout: 5000,//单次定位超时时间,可选参数仅Android有效
                locationInterval: 4000,//连续定位、保活定位间隔 可选参数默认10秒
                notificationTitle: "App后台定位中",//保活前台通知栏 标题、仅Android有效
                notificationContentText: "正在后台定位"//保活前台通知栏 内容、仅Android有效
            })
        },
        methods: {
            onceLocationAction() {
                Location.onceLocation({
                    locationResultBackcall: (res) => {
                        if (res.code == 200) {
                            this.locationCount++;
                            uni.showToast({
                                icon: 'none',
                                title: `定位成功:${this.locationCount}---精度:${res.location?.longitude}----纬度:${res.location?.latitude}`
                            })
                        } else {
                            uni.showToast({
                                icon: "none",
                                title: `${res.mes}`
                            })
                        }
                    }
                });
            },
            //连续定位
            startUpdatingLocationAction() {
                Location.startUpdatingLocation({
                    enableBackgroundLocation: false,
                    locationResultBackcall: (res) => {
                        if (res.code == 200) {
                            this.locationCount++;
                            uni.showToast({
                                icon: 'none',
                                title: `定位次数:${this.locationCount}---精度:${res.location?.longitude}----纬度:${res.location?.latitude}`
                            })
                        }
                    }
                } as Location.UpdatingLocationOptions)
            },
            //停止连续定位
            stopUpdatingLocationAction() {
                this.locationCount = 0
                Location.stopUpdatingLocation()
            },
            //保活
            keepAliveAction() {
                Location.keepLiveLocation({
                    locationResultBackcall: (res) => {
                        console.log('1111111111111')
                        if (res.code == 200) {
                            this.locationCount++;
                            uni.showToast({
                                icon: 'none',
                                title: `定位次数:${this.locationCount}---精度:${res.location?.longitude}----纬度:${res.location?.latitude}`
                            })
                        }
                    }
                })
            },
            //停止保活
            nonKeepAliveAction() {
                this.locationCount = 0
                Location.offKeepLiveLocation()
            }
        }
    }
</script>
<style>
    .content {
        width: 750rpx;
        display: flex;
        height: 100%;
        flex-direction: column;
    }
    .header {
        width: 750rpx;
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        padding: 0 10rpx;
        margin-top: 40rpx;
        box-sizing: border-box;
    }
    .btn {
        display: flex;
        height: 80rpx;
        flex: 1;
        align-items: center;
        justify-content: center;
        background-color: cadetblue;
        color: white;
        margin-right: 10rpx;
        font-size: 28rpx;
    }
</style>
 
                                                                     
                                                                                                                                                 收藏人数:
                                                                        收藏人数:
                                     购买源码授权版(
                                                            购买源码授权版( 试用
                                                                                                                试用
                                                     赞赏(0)
                                        赞赏(0)
                                     下载 21
 下载 21
                 赞赏 0
 赞赏 0
                 
             
                     下载 10664987
                    下载 10664987 
                 赞赏 1797
                        赞赏 1797 
                     
             
                     
             
                     
             
                     
             
                     
             
                     
             
                     
             
                     
             
                     
             
                     
             
                     
             
                     
             
                     
             
                     
             
                     
                         赞赏
                                赞赏
                             
             京公网安备:11010802035340号
京公网安备:11010802035340号