Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
Hello UTS
提交
b3beda80
H
Hello UTS
项目概览
DCloud
/
Hello UTS
通知
1598
Star
27
Fork
9
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
2
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
H
Hello UTS
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
2
Issue
2
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
b3beda80
编写于
9月 06, 2022
作者:
杜庆泉
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
uts location add
上级
820d5548
变更
12
显示空白变更内容
内联
并排
Showing
12 changed file
with
227 addition
and
14 deletion
+227
-14
manifest.json
manifest.json
+2
-2
pages/SDKIntegration/SDKIntegration.vue
pages/SDKIntegration/SDKIntegration.vue
+11
-2
uni_modules/uts-advance/utssdk/app-android/index.uts
uni_modules/uts-advance/utssdk/app-android/index.uts
+11
-10
uni_modules/uts-tencentgeolocation/changelog.md
uni_modules/uts-tencentgeolocation/changelog.md
+0
-0
uni_modules/uts-tencentgeolocation/package.json
uni_modules/uts-tencentgeolocation/package.json
+81
-0
uni_modules/uts-tencentgeolocation/readme.md
uni_modules/uts-tencentgeolocation/readme.md
+5
-0
uni_modules/uts-tencentgeolocation/utssdk/app-android/AndroidManifest.xml
...tencentgeolocation/utssdk/app-android/AndroidManifest.xml
+34
-0
uni_modules/uts-tencentgeolocation/utssdk/app-android/config.json
...les/uts-tencentgeolocation/utssdk/app-android/config.json
+11
-0
uni_modules/uts-tencentgeolocation/utssdk/app-android/index.uts
...dules/uts-tencentgeolocation/utssdk/app-android/index.uts
+55
-0
uni_modules/uts-tencentgeolocation/utssdk/app-android/libs/TencentLocationSDK-v7.4.9.jar
...ion/utssdk/app-android/libs/TencentLocationSDK-v7.4.9.jar
+0
-0
uni_modules/uts-tencentgeolocation/utssdk/app-android/libs/androix-core-1.0.0.jar
...eolocation/utssdk/app-android/libs/androix-core-1.0.0.jar
+0
-0
uni_modules/uts-tencentgeolocation/utssdk/app-android/proguard-rules.pro
...-tencentgeolocation/utssdk/app-android/proguard-rules.pro
+17
-0
未找到文件。
manifest.json
浏览文件 @
b3beda80
...
@@ -2,8 +2,8 @@
...
@@ -2,8 +2,8 @@
"name"
:
"HelloUTS"
,
"name"
:
"HelloUTS"
,
"appid"
:
"__UNI__70BE9D0"
,
"appid"
:
"__UNI__70BE9D0"
,
"description"
:
""
,
"description"
:
""
,
"versionName"
:
"1.0.
1
"
,
"versionName"
:
"1.0.
5
"
,
"versionCode"
:
"10
1
"
,
"versionCode"
:
"10
5
"
,
"transformPx"
:
false
,
"transformPx"
:
false
,
/*
5
+App特有相关
*/
/*
5
+App特有相关
*/
"app-plus"
:
{
"app-plus"
:
{
...
...
pages/SDKIntegration/SDKIntegration.vue
浏览文件 @
b3beda80
<
template
>
<
template
>
<view>
<view>
<page-head
:title=
"title"
></page-head>
<page-head
:title=
"title"
></page-head>
<view
class=
"uni-btn-v uni-common-mt"
>
<button
type=
"primary"
@
tap=
"testGetlocation"
>
获取定位信息
</button>
</view>
</view>
</view>
</
template
>
</
template
>
<
script
>
<
script
>
import
{
requestPremission
,
getLocation
}
from
"
@/uni_modules/uts-tencentgeolocation
"
;
export
default
{
export
default
{
data
()
{
data
()
{
return
{
return
{
...
@@ -13,7 +17,12 @@
...
@@ -13,7 +17,12 @@
}
}
},
},
methods
:
{
methods
:
{
testGetlocation
:
function
(
e
){
requestPremission
();
var
locationRet
=
getLocation
();
console
.
log
(
locationRet
);
},
}
}
}
}
</
script
>
</
script
>
...
...
uni_modules/uts-advance/utssdk/app-android/index.uts
浏览文件 @
b3beda80
import { getUniActivity,getAppContext } from "io.dcloud.uts.android";
import Rect from "android.graphics.Rect";
import Rect from "android.graphics.Rect";
import Color from "android.graphics.Color";
import Color from "android.graphics.Color";
import TextView from "android.widget.TextView";
import TextView from "android.widget.TextView";
...
@@ -10,6 +9,17 @@ import Runnable from 'java.lang.Runnable';
...
@@ -10,6 +9,17 @@ import Runnable from 'java.lang.Runnable';
import Exception from 'java.lang.Exception';
import Exception from 'java.lang.Exception';
import MediaPlayer from 'android.media.MediaPlayer';
import MediaPlayer from 'android.media.MediaPlayer';
import logo from "../../static/logo.png";
import {
onAppActivityDestroy,
onAppActivityPause,
onAppActivityResume,
onAppActivityBack,
getUniActivity,
getAppContext
} from "io.dcloud.uts.android";
/**
/**
* 定时任务参数封装
* 定时任务参数封装
*/
*/
...
@@ -105,15 +115,7 @@ export function removeViewToDecorView() {
...
@@ -105,15 +115,7 @@ export function removeViewToDecorView() {
}
}
import logo from "../../static/logo.png";
import {
onAppActivityDestroy,
onAppActivityPause,
onAppActivityResume,
onAppActivityBack,
} from "io.dcloud.uts.android";
export function getLogoPath(): string {
export function getLogoPath(): string {
...
@@ -139,7 +141,6 @@ export function playAssetAudio() {
...
@@ -139,7 +141,6 @@ export function playAssetAudio() {
export function initAppLifecycle(onLifecycleChange: (event:string) => void) {
export function initAppLifecycle(onLifecycleChange: (event:string) => void) {
onAppActivityDestroy(() => {
onAppActivityDestroy(() => {
let eventName = "onAppActivityDestroy - " + Date.now();
let eventName = "onAppActivityDestroy - " + Date.now();
onLifecycleChange(eventName);
onLifecycleChange(eventName);
console.log(eventName);
console.log(eventName);
...
...
uni_modules/uts-tencentgeolocation/changelog.md
0 → 100644
浏览文件 @
b3beda80
uni_modules/uts-tencentgeolocation/package.json
0 → 100644
浏览文件 @
b3beda80
{
"id"
:
"uts-tencentgeolocation"
,
"displayName"
:
"uts-tencentgeolocation"
,
"version"
:
"1.0.0"
,
"description"
:
"uts-tencentgeolocation"
,
"keywords"
:
[
"uts-tencentgeolocation"
],
"repository"
:
""
,
"engines"
:
{
"HBuilderX"
:
"^3.6.0"
},
"dcloudext"
:
{
"type"
:
"uts"
,
"sale"
:
{
"regular"
:
{
"price"
:
"0.00"
},
"sourcecode"
:
{
"price"
:
"0.00"
}
},
"contact"
:
{
"qq"
:
""
},
"declaration"
:
{
"ads"
:
""
,
"data"
:
""
,
"permissions"
:
""
},
"npmurl"
:
""
},
"uni_modules"
:
{
"dependencies"
:
[],
"encrypt"
:
[],
"platforms"
:
{
"cloud"
:
{
"tcb"
:
"u"
,
"aliyun"
:
"u"
},
"client"
:
{
"Vue"
:
{
"vue2"
:
"n"
,
"vue3"
:
"y"
},
"App"
:
{
"app-android"
:
"u"
,
"app-ios"
:
"u"
},
"H5-mobile"
:
{
"Safari"
:
"u"
,
"Android Browser"
:
"u"
,
"微信浏览器(Android)"
:
"u"
,
"QQ浏览器(Android)"
:
"u"
},
"H5-pc"
:
{
"Chrome"
:
"u"
,
"IE"
:
"u"
,
"Edge"
:
"u"
,
"Firefox"
:
"u"
,
"Safari"
:
"u"
},
"小程序"
:
{
"微信"
:
"u"
,
"阿里"
:
"u"
,
"百度"
:
"u"
,
"字节跳动"
:
"u"
,
"QQ"
:
"u"
,
"钉钉"
:
"u"
,
"快手"
:
"u"
,
"飞书"
:
"u"
,
"京东"
:
"u"
},
"快应用"
:
{
"华为"
:
"u"
,
"联盟"
:
"u"
}
}
}
}
}
\ No newline at end of file
uni_modules/uts-tencentgeolocation/readme.md
0 → 100644
浏览文件 @
b3beda80
# uts-tencentgeolocation
### 开发文档
[
UTS 语法
](
https://uniapp.dcloud.net.cn/tutorial/syntax-uts.html
)
[
UTS 原生插件
](
https://uniapp.dcloud.net.cn/plugin/uts-plugin.html
)
[
Hello UTS
](
https://gitcode.net/dcloud/hello-uts/-/tree/dev
)
\ No newline at end of file
uni_modules/uts-tencentgeolocation/utssdk/app-android/AndroidManifest.xml
0 → 100644
浏览文件 @
b3beda80
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:tools=
"http://schemas.android.com/tools"
package=
"io.dcloud.nativeresouce"
>
<!--permissions-->
<!-- 通过GPS得到精确位置 -->
<uses-permission
android:name=
"android.permission.ACCESS_FINE_LOCATION"
/>
<!-- 通过网络得到粗略位置 -->
<uses-permission
android:name=
"android.permission.ACCESS_COARSE_LOCATION"
/>
<!-- 访问网络,某些位置信息需要从网络服务器获取 -->
<uses-permission
android:name=
"android.permission.INTERNET"
/>
<!-- 访问WiFi状态,需要WiFi信息用于网络定位 -->
<uses-permission
android:name=
"android.permission.ACCESS_WIFI_STATE"
/>
<!-- 修改WiFi状态,发起WiFi扫描, 需要WiFi信息用于网络定位 -->
<uses-permission
android:name=
"android.permission.CHANGE_WIFI_STATE"
/>
<!-- 访问网络状态, 检测网络的可用性,需要网络运营商相关信息用于网络定位 -->
<uses-permission
android:name=
"android.permission.ACCESS_NETWORK_STATE"
/>
<!-- 访问网络的变化, 需要某些信息用于网络定位 -->
<uses-permission
android:name=
"android.permission.CHANGE_NETWORK_STATE"
/>
<!-- 蓝牙扫描权限 -->
<uses-permission
android:name=
"android.permission.BLUETOOTH"
/>
<uses-permission
android:name=
"android.permission.BLUETOOTH_ADMIN"
/>
<!-- 前台service权限 -->
<uses-permission
android:name=
"android.permission.FOREGROUND_SERVICE"
/>
<!-- 后台定位权限 -->
<uses-permission
android:name=
"android.permission.ACCESS_BACKGROUND_LOCATION"
/>
<!-- A-GPS辅助定位权限,方便GPS快速准确定位 -->
<uses-permission
android:name=
"android.permission.ACCESS_LOCATION_EXTRA_COMMANDS"
/>
<application>
<!--meta-data-->
<meta-data
android:name=
"TencentMapSDK"
android:value=
"JQXBZ-GYRLK-SZLJ2-APDLD-O5QUH-YQFLH"
/>
</application>
</manifest>
uni_modules/uts-tencentgeolocation/utssdk/app-android/config.json
0 → 100644
浏览文件 @
b3beda80
{
"libs"
:
[],
"dependencies"
:
[{
"id"
:
"androidx.core:core"
,
"source"
:
"implementation 'androidx.core:core:1.0.0'"
},
{
"id"
:
"com.tencent.map.geolocation:TencentLocationSdk-openplatform"
,
"source"
:
"implementation 'com.tencent.map.geolocation:TencentLocationSdk-openplatform:7.3.0'"
}],
"minSdkVersion"
:
21
}
uni_modules/uts-tencentgeolocation/utssdk/app-android/index.uts
0 → 100644
浏览文件 @
b3beda80
import {
onAppActivityPause,
onAppActivityRequestPermissionsResult,
getUniActivity,
getAppContext
} from "io.dcloud.uts.android";
import ActivityCompat from "androidx.core.app.ActivityCompat";
import Manifest from "android.Manifest";
import Looper from "android.os.Looper";
import TencentLocationManager from "com.tencent.map.geolocation.TencentLocationManager";
import TencentLocationListener from "com.tencent.map.geolocation.TencentLocationListener";
import TencentLocation from "com.tencent.map.geolocation.TencentLocation";
export function requestPremission() {
// 注册一个请求回调
// onAppActivityRequestPermissionsResult((requestCode: number,
// permissions: Array<string>,
// grantResults: Array<number>) => {
// let eventName = "onAppActivityRequestPermissionsResult - " + Date.now();
// console.log(eventName);
// });
//发起权限申请
// let permissions:string[] = [Manifest.permission.ACCESS_COARSE_LOCATION]
ActivityCompat.requestPermissions(
getUniActivity()!,
arrayOf(Manifest.permission.ACCESS_COARSE_LOCATION), 1001);
// 请求权限
return { name: "requestPremission"};
}
class SingleLocationListener extends TencentLocationListener {
override onLocationChanged(location:TencentLocation , error:Int ,
reason:string ):Unit{
console.log(location);
}
override onStatusUpdate(name:string, status:Int, desc:string ):Unit{
console.log(name);
}
}
export function getLocation() {
// 获取当前的地址回调
let mLocationManager = TencentLocationManager.getInstance(getAppContext());
let mLocationListener = new SingleLocationListener();
mLocationManager.requestSingleFreshLocation(null, mLocationListener, Looper.getMainLooper());
// 请求权限
return { name: "getLocation"};
}
\ No newline at end of file
uni_modules/uts-tencentgeolocation/utssdk/app-android/libs/TencentLocationSDK-v7.4.9.jar
0 → 100644
浏览文件 @
b3beda80
文件已添加
uni_modules/uts-tencentgeolocation/utssdk/app-android/libs/androix-core-1.0.0.jar
0 → 100644
浏览文件 @
b3beda80
文件已添加
uni_modules/uts-tencentgeolocation/utssdk/app-android/proguard-rules.pro
0 → 100644
浏览文件 @
b3beda80
-
keepattributes
*
Annotation
*
-
keepclassmembers
class
**
{
public
void
on
*
Event
(...);
}
-
keep
public
class
com
.
tencent
.
location
.
**
{
public
protected
*
;
}
-
keepclasseswithmembernames
class
*
{
native
<
methods
>
;
}
-
keep
class
c
.
t
.
**
{
*
;}
-
keep
class
com
.
tencent
.
map
.
geolocation
.
**
{
*
;}
-
dontwarn
org
.
eclipse
.
jdt
.
annotation
.
**
-
dontwarn
c
.
t
.
**
-
dontwarn
android
.
location
.
Location
-
dontwarn
android
.
net
.
wifi
.
WifiManager
-
dontnote
ct
.
**
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录