Commit 7ffe7ac4 authored by Sky's avatar Sky

~

parent 93ab5b42
......@@ -13,7 +13,7 @@ ohos {
signAlg 'SHA256withECDSA'
}
}
compileSdkVersion 3
compileSdkVersion 4
defaultConfig {
compatibleSdkVersion 3
}
......@@ -30,7 +30,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.huawei.ohos:hap:2.0.0.6'
classpath 'com.huawei.ohos:hap:2.4.1.4'
}
}
......
......@@ -6,9 +6,9 @@ ohos {
certpath file('D:/HuaweiWatchClient/com.company.fit.overseas_debug.cer')
profile file('D:/HuaweiWatchClient/com.company.fit.proDebug.p7b')
signAlg 'SHA256withECDSA'
keyPassword '0000001B9E576AD11A22A05641A642CA17ED844BB71D8027C1ACF79F928F7C1EA950008D8C70ADDF7E8429'
keyPassword '0000001B17F8F53E0CF14D52675968C4FD60AA48E6580B4EEEE4AE8348FA556850E01CC92EEA6DE834CA36'
keyAlias 'huawei_watch_overseas Release'
storePassword '0000001B3F89F001102D6FF1A0BB38E371027272283910D107D7F11A763F26295938F1A4E704A7F054C552'
storePassword '0000001B16A4C8B18003852BF6E890B38F6D624C8314D7E55CE2FD87CBC3F2C9E2DA9403C977F0C988ABAE'
storeFile file('D:/HuaweiWatchClient/huawei_watch_overseas.p12')
}
release {
......@@ -21,7 +21,8 @@ ohos {
certpath file('D:/HuaweiWatchClient/com.company.fit.overseas_release.cer')
}
}
compileSdkVersion 3
mergeJsSrc true
compileSdkVersion 4
defaultConfig {
compatibleSdkVersion 3
}
......
......@@ -2,18 +2,19 @@
"app": {
"bundleName": "com.company.fit",
"version": {
"code": 15,
"name": "1.0.1"
"code": 20,
"name": "1.0.2"
},
"apiVersion": {
"compatible": 3,
"target": 3
"target": 4
}
},
"deviceConfig": {},
"module": {
"deviceType": [
"liteWearable"
"liteWearable",
"wearable"
],
"abilities": [
{
......
This diff is collapsed.
import brightness from '@system.brightness' //保持屏幕常亮
import app from '@system.app' //右滑退出
import router from '@system.router' //页面跳转
import {P2pClient} from '../wearengine'
// 步骤1:创建点对点通信对象
var p2pClient = new P2pClient();
export default {
data: {
......@@ -31,7 +35,10 @@ export default {
},
onDestroy() {
//取消接收手机侧第三方应用发过来的消息
FeatureAbility.unsubscribeMsg();
p2pClient.unregisterReceiver({
onSuccess: function () {
},
});
},
start(msg) {
let _this = this;
......@@ -52,13 +59,19 @@ export default {
*/
getMsg() {
let _this = this;
FeatureAbility.subscribeMsg({
success: function (data) {
_this.start(JSON.parse(data.message));
// 步骤4:接收手机侧第三方应用发过来的简短消息或文件
var receiver = {
onSuccess: function () {
// 处理注册接收手机侧简短消息或文件成功的回调函数
},
fail: function (data, code) {
}
});
onFailure: function () {
// 处理注册接收手机侧简短消息或文件失败的回调函数
},
onReceiveMessage: function (data) {
_this.start(JSON.parse(data));
},
}
p2pClient.registerReceiver(receiver);
},
/**
......
......@@ -4,8 +4,13 @@ import brightness from '@system.brightness' //保持屏幕常亮
import app from '@system.app' //右滑退出
import router from '@system.router' //页面跳转
import storage from '@system.storage' //本地数据
import {P2pClient, Message, Builder} from '../wearengine'
var timer;
// 步骤1:创建点对点通信对象
var p2pClient = new P2pClient();
var builderClient = new Builder();
var sendMessage = new Message();
export default {
data: {
......@@ -31,6 +36,9 @@ export default {
isFirstInit: true, //是否是第一次初始化事件
showPrivacy: true, //显示隐私权限页面
},
onInit() {
p2pClient.setPeerPkgName("com.sportq.fit");
},
onReady() {
let _this = this;
//获取本地隐私权限标识
......@@ -102,7 +110,10 @@ export default {
});
this.quit();
//取消接收手机侧第三方应用发过来的消息
FeatureAbility.unsubscribeMsg();
p2pClient.unregisterReceiver({
onSuccess: function () {
},
});
},
start(msg) {
let _this = this;
......@@ -323,16 +334,16 @@ export default {
*/
checkInstall() {
let _this = this;
FeatureAbility.detect({
bundleName: 'com.sportq.fit',
success: function () {
//已安装
p2pClient.ping({
onSuccess: function () {
console.log('ping success.');
},
fail: function (data, code) {
if (!data && !code) { //未安装
_this.page = "99";
_this.isJumpLoginPage = false;
}
onFailure: function () {
_this.page = "99";
_this.isJumpLoginPage = false;
},
onPingResult: function (resultCode) {
console.log(resultCode.data + resultCode.code);
},
});
},
......@@ -344,19 +355,26 @@ export default {
sendMsg(obj) {
let _this = this;
_this.sendFlg = true;
FeatureAbility.sendMsg({
deviceId: 'remote',
bundleName: 'com.sportq.fit',
message: JSON.stringify(obj),
success: function () {
// 步骤4:发送简短消息到手机侧对应的第三方应用
builderClient.setDescription(JSON.stringify(obj));
sendMessage.builder = builderClient;
// 定义回调函数
var sendCallback = {
onSuccess: function () {
_this.sendFlg = false;
console.log('sendMsg success.');
},
fail: function (data, code) {
onFailure: function () {
_this.sendFlg = false;
console.log('handing fail, message: ' + data + ', code: ' + code);
}
});
},
onSendResult: function (resultCode) {
// send任务执行结束后返回的错误码和信息进行处理
console.log(resultCode.data + resultCode.code);
},
}
if (sendMessage != null && sendCallback != null) {
p2pClient.send(sendMessage, sendCallback);
}
;
},
/**
......@@ -364,15 +382,23 @@ export default {
*/
sendHeartRateMsg(obj) {
let _this = this;
FeatureAbility.sendMsg({
deviceId: 'remote',
bundleName: 'com.sportq.fit',
message: JSON.stringify(obj),
success: function () {
// 步骤4:发送简短消息到手机侧对应的第三方应用
builderClient.setDescription(JSON.stringify(obj));
sendMessage.builder = builderClient;
// 定义回调函数
var sendCallback = {
onSuccess: function () {
},
fail: function (data, code) {
}
});
onFailure: function () {
},
onSendResult: function (resultCode) {
console.log(resultCode.data + resultCode.code);
},
}
if (sendMessage != null && sendCallback != null) {
p2pClient.send(sendMessage, sendCallback);
}
;
},
/**
......@@ -394,13 +420,19 @@ export default {
*/
getMsg() {
let _this = this;
FeatureAbility.subscribeMsg({
success: function (data) {
_this.start(JSON.parse(data.message));
// 步骤4:接收手机侧第三方应用发过来的简短消息或文件
var receiver = {
onSuccess: function () {
// 处理注册接收手机侧简短消息或文件成功的回调函数
},
fail: function (data, code) {
}
});
onFailure: function () {
// 处理注册接收手机侧简短消息或文件失败的回调函数
},
onReceiveMessage: function (data) {
_this.start(JSON.parse(data));
},
}
p2pClient.registerReceiver(receiver);
}
,
......@@ -523,7 +555,10 @@ export default {
this.progress = "", //进度条
this.countdownT = "", // 倒计时
//取消接收手机侧第三方应用发过来的消息
FeatureAbility.unsubscribeMsg();
p2pClient.unregisterReceiver({
onSuccess: function () {
},
});
sensor.unsubscribeHeartRate() //取消监听心率
},
......
This diff is collapsed.
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
File added
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment