Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
Hello UTS
提交
2beb3777
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看板
提交
2beb3777
编写于
9月 09, 2022
作者:
杜庆泉
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
解决腾讯定位 libs打包报错的问题
上级
56128bf5
变更
12
显示空白变更内容
内联
并排
Showing
12 changed file
with
128 addition
and
48 deletion
+128
-48
AndroidManifest.xml
AndroidManifest.xml
+10
-0
manifest.json
manifest.json
+2
-2
pages/advance/advance.vue
pages/advance/advance.vue
+21
-6
pages/index/index.vue
pages/index/index.vue
+12
-2
uni_modules/uts-advance/utssdk/app-android/config.json
uni_modules/uts-advance/utssdk/app-android/config.json
+0
-2
uni_modules/uts-advance/utssdk/app-android/index.uts
uni_modules/uts-advance/utssdk/app-android/index.uts
+53
-14
uni_modules/uts-advance/utssdk/app-android/utils.uts
uni_modules/uts-advance/utssdk/app-android/utils.uts
+0
-3
uni_modules/uts-helloworld/utssdk/app-android/index.uts
uni_modules/uts-helloworld/utssdk/app-android/index.uts
+13
-5
uni_modules/uts-tencentgeolocation/utssdk/app-android/AndroidManifest.xml
...tencentgeolocation/utssdk/app-android/AndroidManifest.xml
+1
-5
uni_modules/uts-tencentgeolocation/utssdk/app-android/config.json
...les/uts-tencentgeolocation/utssdk/app-android/config.json
+0
-5
uni_modules/uts-tencentgeolocation/utssdk/app-android/index.uts
...dules/uts-tencentgeolocation/utssdk/app-android/index.uts
+16
-4
uni_modules/uts-tencentgeolocation/utssdk/app-android/libs/androix-core-1.0.0-自定义基座时移除.jar
...n/utssdk/app-android/libs/androix-core-1.0.0-自定义基座时移除.jar
+0
-0
未找到文件。
AndroidManifest.xml
0 → 100644
浏览文件 @
2beb3777
<?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.hellouts"
>
<application>
<!--meta-data-->
<meta-data
android:name=
"TencentMapSDK"
android:value=
"您申请的腾讯定位App Key"
/>
</application>
</manifest>
manifest.json
浏览文件 @
2beb3777
...
...
@@ -2,8 +2,8 @@
"name"
:
"HelloUTS"
,
"appid"
:
"__UNI__70BE9D0"
,
"description"
:
""
,
"versionName"
:
"1.0.
8
"
,
"versionCode"
:
"10
8
"
,
"versionName"
:
"1.0.
9
"
,
"versionCode"
:
"10
9
"
,
"transformPx"
:
false
,
/*
5
+App特有相关
*/
"app-plus"
:
{
...
...
pages/advance/advance.vue
浏览文件 @
2beb3777
...
...
@@ -14,7 +14,7 @@
<view
class=
"uni-btn-v uni-common-mt"
>
<button
type=
"primary"
@
tap=
"testAddToDecorView"
>
添加TextView至视图顶层
</button>
<button
type=
"primary"
@
tap=
"testRemoveToDecorView"
>
移除视图顶层的TextView
</button>
<button
type=
"primary"
@
tap=
"
testResource
"
>
资源加载示例
</button>
<button
type=
"primary"
@
tap=
"
gotoResourceDemo
"
>
资源加载示例
</button>
<button
type=
"primary"
@
tap=
"testLifecyle"
>
activity生命周期监听
</button>
</view>
...
...
@@ -38,9 +38,11 @@
taskId
:
0
}
},
onUnload
:
function
(){
},
methods
:
{
/**
* 测试延迟任务
*/
testTimer
:
function
()
{
doTimerTask
({
start
:
function
(
response
){
...
...
@@ -57,6 +59,9 @@
},
});
},
/**
* 测试周期任务
*/
testInterval
:
function
()
{
var
ret
=
doIntervalTask
({
start
:
function
(
response
){
...
...
@@ -74,21 +79,31 @@
});
this
.
taskId
=
ret
.
taskId
;
},
/**
* 取消周期任务
*/
testClearInterval
:
function
()
{
console
.
log
(
this
.
taskId
);
clearIntervalTask
(
this
.
taskId
);
},
/**
* 测试添加View实例至顶层容器
*/
testAddToDecorView
:
function
()
{
addViewToDecorView
();
},
/**
* 测试移除顶层容器的View实例
*/
testRemoveToDecorView
:
function
()
{
removeViewToDecorView
();
},
testResource
:
function
()
{
/**
* 跳转至资源加载演示界面
*/
gotoResourceDemo
:
function
()
{
uni
.
navigateTo
({
url
:
'
/pages/resource/resource
'
})
...
...
pages/index/index.vue
浏览文件 @
2beb3777
...
...
@@ -19,9 +19,12 @@
stringParam
:
"
hello world
"
,
}
},
onUnload
:
function
(){
},
methods
:
{
/**
* 测试无参数调用
*/
testDoSthWithCallback
:
function
()
{
UTSHello
.
callWithoutParam
(
...
...
@@ -33,7 +36,11 @@
}
);
},
/**
* 测试字符串参数回调
*/
testDoSthWithString
:
function
()
{
UTSHello
.
callWithStringParam
(
this
.
stringParam
,
function
(
response
){
...
...
@@ -44,6 +51,9 @@
},
);
},
/**
* 测试json参数回调
*/
testDoSthWithJSON
:
function
()
{
var
inputObject
=
{
inputText
:
this
.
stringParam
...
...
uni_modules/uts-advance/utssdk/app-android/config.json
已删除
100644 → 0
浏览文件 @
56128bf5
{
}
\ No newline at end of file
uni_modules/uts-advance/utssdk/app-android/index.uts
浏览文件 @
2beb3777
...
...
@@ -20,11 +20,20 @@ import {
getAppContext
} from "io.dcloud.uts.android";
/**
* 定时任务参数封装
*/
type TimerOptions = {
/**
* 定时任务开始的回调
* @res 回调参数
*/
start: (res: string) => void;
/**
* 定时任务执行的回调
* @res 回调参数
*/
work: (res: string) => void;
};
...
...
@@ -60,12 +69,14 @@ export function doIntervalTask(opts:TimerOptions) {
export function clearIntervalTask(taskId:number) {
clearInterval(taskId);
return { name: "clearIntervalTask"};
}
/**
* 实现一个添加view的 Runnable类
* 用法说明:https://uniapp.dcloud.net.cn/plugin/uts-plugin.html#%E5%8C%BF%E5%90%8D%E5%86%85%E9%83%A8%E7%B1%BB
*/
class AddUIRunnable extends Runnable {
override run():void {
...
...
@@ -89,6 +100,10 @@ class AddUIRunnable extends Runnable {
}
};
/**
* 实现一个移除view的 Runnable类
* 用法说明:https://uniapp.dcloud.net.cn/plugin/uts-plugin.html#%E5%8C%BF%E5%90%8D%E5%86%85%E9%83%A8%E7%B1%BB
*/
class RemoveUIRunnable extends Runnable {
override run():void {
...
...
@@ -102,27 +117,34 @@ class RemoveUIRunnable extends Runnable {
}
};
/**
* 实现添加view实例至decorview
*
*/
export function addViewToDecorView() {
let uiRunable = new AddUIRunnable();
getUniActivity()!.runOnUiThread(uiRunable)
}
/**
* 实现从decorview上移除指定view
*/
export function removeViewToDecorView() {
var uiRunable = new RemoveUIRunnable();
getUniActivity()!.runOnUiThread(uiRunable)
}
/**
* 引用资源路径
*/
export function getLogoPath(): string {
return logo;
}
/**
* 播放asset资源中的音频
*/
export function playAssetAudio() {
let assetManager = getAppContext()!.getAssets();
...
...
@@ -135,26 +157,43 @@ export function playAssetAudio() {
}
/**
* 初始化应用生命周期监听
*
*/
export function initAppLifecycle(onLifecycleChange: (event:string) => void) {
/**
* activity 销毁生命周期回调
* 说明文档:https://uniapp.dcloud.net.cn/plugin/uts-plugin.html#onappactivitydestroy
*/
onAppActivityDestroy(() => {
let eventName = "onAppActivityDestroy - " + Date.now();
onLifecycleChange(eventName);
console.log(eventName);
});
/**
* activity 失去焦点生命周期回调
* 说明文档:https://uniapp.dcloud.net.cn/plugin/uts-plugin.html#onappactivitypause
*/
onAppActivityPause(() => {
let eventName = "onAppActivityPause - " + Date.now();
onLifecycleChange(eventName);
console.log(eventName);
});
/**
* activity 得到焦点的周期回调
* 说明文档:https://uniapp.dcloud.net.cn/plugin/uts-plugin.html#onappactivityresume
*/
onAppActivityResume(() => {
let eventName = "onAppActivityResume - " + Date.now();
onLifecycleChange(eventName);
console.log(eventName);
});
/**
* activity 回退物理按键事件回调
* 说明文档:https://uniapp.dcloud.net.cn/plugin/uts-plugin.html#onappactivityback
*/
onAppActivityBack(() => {
let eventName = "onAppActivityBack - " + Date.now();
onLifecycleChange(eventName);
...
...
uni_modules/uts-advance/utssdk/app-android/utils.uts
已删除
100644 → 0
浏览文件 @
56128bf5
export function log(msg: string) {
console.log(msg);
}
uni_modules/uts-helloworld/utssdk/app-android/index.uts
浏览文件 @
2beb3777
/**
* json参数格式定义
*/
type inputJSON = {
inputText: string,
errCode: number
}
/**
* json入参格式
*/
type JsonParamOptions = {
input: inputJSON;
success: (res: string) => void;
...
...
@@ -13,7 +17,7 @@ type JsonParamOptions = {
/**
* 导出
一个带callback的同步方法
* 导出
无参的UTS函数
* @param opts
*/
export function callWithoutParam(success: () => void) {
...
...
@@ -21,13 +25,17 @@ export function callWithoutParam(success: () => void) {
return { name: "doSthWithCallback" };
}
/**
* 导出一个字符串入参的UTS函数
*/
export function callWithStringParam(input: string, success: (res: string) => void) {
success(input);
return { name: "doSthWithCallback" };
}
/**
* 导出一个JSON入参的UTS函数
*/
export function callWithJSONParam(opts: JsonParamOptions) {
opts.input.errCode = 10;
opts.success(opts.input);
...
...
uni_modules/uts-tencentgeolocation/utssdk/app-android/AndroidManifest.xml
浏览文件 @
2beb3777
...
...
@@ -26,9 +26,5 @@
<!-- A-GPS辅助定位权限,方便GPS快速准确定位 -->
<uses-permission
android:name=
"android.permission.ACCESS_LOCATION_EXTRA_COMMANDS"
/>
<application>
<!--meta-data-->
<meta-data
android:name=
"TencentMapSDK"
android:value=
"您申请的app key"
/>
</application>
</manifest>
uni_modules/uts-tencentgeolocation/utssdk/app-android/config.json
浏览文件 @
2beb3777
{
"dependencies"
:
[
{
"id"
:
"com.tencent.map.geolocation:TencentLocationSdk-openplatform"
,
"source"
:
"implementation 'com.tencent.map.geolocation:TencentLocationSdk-openplatform:7.4.9'"
}],
"minSdkVersion"
:
21
}
uni_modules/uts-tencentgeolocation/utssdk/app-android/index.uts
浏览文件 @
2beb3777
...
...
@@ -16,6 +16,12 @@ import TencentLocationRequest from "com.tencent.map.geolocation.TencentLocationR
export function requestPremission() {
/**
* 同意隐私协议。重要!!
* 说明文档:https://lbs.qq.com/mobile/androidLocationSDK/androidGeoGuide/agreePrivacy
*/
TencentLocationManager.setUserAgreePrivacy(true);
// 注册一个请求回调
onAppActivityRequestPermissionsResult((requestCode: number,
permissions: MutableList<string>,
...
...
@@ -28,8 +34,8 @@ export function requestPremission() {
console.log(permissions);
console.log(requestCode);
});
// 发起权限申请
// 发起权限申请
ActivityCompat.requestPermissions(
getUniActivity()!,
arrayOf(Manifest.permission.ACCESS_COARSE_LOCATION,Manifest.permission.ACCESS_FINE_LOCATION), 1001);
...
...
@@ -57,6 +63,10 @@ type LocationResponse = {
longitude?:number
}
/**
* 定位监听结果包装类
*/
class LocationOptionsWapper{
hostOption:LocationOptions;
...
...
@@ -101,7 +111,7 @@ class SingleLocationListener extends TencentLocationListener {
reason:string ):void{
console.log(error);
console.log(reason);
console.log(
location
);
console.log(
error
);
this.hostOptionWraper.onLocationChanged(location,error,reason);
}
...
...
@@ -118,6 +128,7 @@ class SingleLocationListener extends TencentLocationListener {
*/
export function getLocation(locationOptions: LocationOptions) {
let mLocationManager = TencentLocationManager.getInstance(getAppContext());
// 定位监听器封装
let locationOptionWrapper = new LocationOptionsWapper(locationOptions);
...
...
@@ -130,7 +141,8 @@ export function getLocation(locationOptions: LocationOptions) {
}else{
locationRequest.setRequestLevel(TencentLocationRequest.REQUEST_LEVEL_GEO);
}
console.log(locationRequest);
mLocationManager.requestSingleFreshLocation(null, mLocationListener, Looper.getMainLooper());
mLocationManager.requestSingleFreshLocation(locationRequest, mLocationListener, Looper.getMainLooper());
return { name: "getLocation"};
}
\ No newline at end of file
uni_modules/uts-tencentgeolocation/utssdk/app-android/libs/androix-core-1.0.0-自定义基座
需
移除.jar
→
uni_modules/uts-tencentgeolocation/utssdk/app-android/libs/androix-core-1.0.0-自定义基座
时
移除.jar
浏览文件 @
2beb3777
文件已移动
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录