|
|
@@ -172,17 +172,22 @@ export default class EntryAbility extends UIAbility {
|
|
|
}
|
|
|
|
|
|
onDestroy() {
|
|
|
+ try {
|
|
|
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy');
|
|
|
- if(this.awareness){
|
|
|
- let types: smartMobilityCommon.SmartMobilityType[] = [smartMobilityCommon.SmartMobilityType.CAR_HOP];
|
|
|
- // 出行连接状态回调函数
|
|
|
- const callBack = (info: smartMobilityCommon.SmartMobilityInfo) => {
|
|
|
- hilog.info(0x0000, 'Received smart mobility info: ', JSON.stringify(info));
|
|
|
- };
|
|
|
- // 解注册智慧出行连接状态的监听 示例2
|
|
|
- this.awareness.off('smartMobilityStatus', types, callBack);
|
|
|
- }
|
|
|
+ if(this.awareness){
|
|
|
+ let types: smartMobilityCommon.SmartMobilityType[] = [smartMobilityCommon.SmartMobilityType.CAR_HOP];
|
|
|
+ // 出行连接状态回调函数
|
|
|
+ const callBack = (info: smartMobilityCommon.SmartMobilityInfo) => {
|
|
|
+ hilog.info(0x0000, 'Received smart mobility info: ', JSON.stringify(info));
|
|
|
+ };
|
|
|
+ // 解注册智慧出行连接状态的监听 示例2
|
|
|
+ this.awareness.off('smartMobilityStatus', types, callBack);
|
|
|
+ }
|
|
|
+ }catch (error) {
|
|
|
+ console.error(`Failed to getHiCarStatus: ${error.code}, message: ${error.message}`);
|
|
|
+
|
|
|
}
|
|
|
+ }
|
|
|
|
|
|
|
|
|
onWindowStageCreate(windowStage: window.WindowStage) {
|