fix: 完善程序启动提示
This commit is contained in:
		
							parent
							
								
									5a5242db17
								
							
						
					
					
						commit
						a567923ebc
					
				| @ -25,4 +25,7 @@ export const UDPTag = '[UdpClient]'; | ||||
| export const FileHelpTag = '[FileHelp]'; | ||||
| 
 | ||||
| //request tag | ||||
| export const RequestTag = '[Request]'; | ||||
| export const RequestTag = '[Request]'; | ||||
| 
 | ||||
| //entry tag | ||||
| export const EntryTag = '[Entry]'; | ||||
| @ -9,10 +9,11 @@ import DB from '../utils/DbSql'; | ||||
| import { DrivingDataStorage } from '../utils/business/DrivingDataStorage'; | ||||
| import { InitTable } from '../utils/table/Operation'; | ||||
| import FileUtils from '../utils/FileUtils'; | ||||
| import { EntryTag } from '../config'; | ||||
| 
 | ||||
| export default class EntryAbility extends UIAbility { | ||||
|   async onCreate(want: Want, launchParam: AbilityConstant.LaunchParam) { | ||||
|     console.log("多伦鸿蒙车载程序启动") | ||||
|     console.log(EntryTag, "多伦鸿蒙车载程序启动") | ||||
|     try { | ||||
|       await DB.init(this.context) | ||||
|       await InitTable() | ||||
| @ -26,9 +27,9 @@ export default class EntryAbility extends UIAbility { | ||||
|         AppStorage.setOrCreate<string>("host", host) | ||||
|       } | ||||
|     } catch (e) { | ||||
|       console.error('sql first error', e) | ||||
|       console.error(EntryTag, 'sql first error', e) | ||||
|     } | ||||
|     hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate'); | ||||
|     console.log(EntryTag, "onCreate", "加载完成") | ||||
|   } | ||||
| 
 | ||||
|   onDestroy() { | ||||
| @ -36,11 +37,11 @@ export default class EntryAbility extends UIAbility { | ||||
|     // TODO UDP缺失 | ||||
|     // lightUDPClient.sendMsg(new Uint8Array(arrClose).buffer) | ||||
|     DrivingDataStorage.close() | ||||
|     hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy'); | ||||
|     console.log(EntryTag, "onDestroy", "销毁完成") | ||||
|   } | ||||
| 
 | ||||
|   async onWindowStageCreate(windowStage: window.WindowStage) { | ||||
|     hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate'); | ||||
|     console.log(EntryTag, "onWindowStageCreate", "窗口创建完成") | ||||
|     const windowClass = await windowStage.getMainWindow(); | ||||
|     let rect = windowClass.getWindowProperties().windowRect | ||||
|     let width = rect.width | ||||
| @ -79,19 +80,20 @@ export default class EntryAbility extends UIAbility { | ||||
| 
 | ||||
|   onWindowStageDestroy() { | ||||
|     // Main window is destroyed, release UI related resources | ||||
|     hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy'); | ||||
|     console.log(EntryTag, "onWindowStageDestroy", "窗口销毁完成") | ||||
|   } | ||||
| 
 | ||||
|   onForeground() { | ||||
|     // Ability has brought to foreground | ||||
|     hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground'); | ||||
|     console.log(EntryTag, "onForeground", "当应用从后台转到前台时触发") | ||||
|   } | ||||
| 
 | ||||
|   onBackground() { | ||||
|     // Ability has back to background | ||||
|     hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground'); | ||||
|     console.log(EntryTag, "onBackground", "当应用从前台转到后台时触发") | ||||
|   } | ||||
| 
 | ||||
|   createFiles() { | ||||
|     console.log(EntryTag, "createFiles", "创建文件") | ||||
|   } | ||||
| } | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user