bada的系统事件
来源:互联网 发布:二叉树的遍历算法c加加 编辑:程序博客网 时间:2024/05/24 01:51
System Events
Application 类提供了处理如下系统事件的事件处理器
- 电池事件(Battery events)
- 内存事件(Memory events)
- 屏幕事件(Screen events)
电池事件(Battery Events)
当电池电量等级改变时该事件被触发。像相机、MP3播放器这样耗电量大的多媒体应用需要检测电池电量等级。使用 OnBatteryLevelChanged()事件处理器来处理电池事件。 当电池电量等级改变时该处理器被调用。
根据电量,推荐下面的处理方式:
- EMPTY:关闭应用程序。
- CRITICAL:停止使用多媒体特性,因为在该电量等级下,不能保证他们能够正常使用。
OnBatteryLevelChanged()事件处理器的使用方法如下:
void MyApplication::OnBatteryLevelChanged(BatteryLevel batteryLevel){ // TODO:}
内存事件(Memory Events)
当设备内存低时该事件被触发。当内存低或不足以运行一个应用时,在OnLowMemory() 事件处理器中从堆中释放不用的内存。
OnLowMemory() 事件处理器使用方法如下:
void MyApplication::OnLowMemory(void){ // TODO:}
屏幕事件(Screen Events)
An application can receive screen events in OnScreenOn() andOnScreenOff() event handlers if it registers a screen event listener. When theOnScreenOff() event handler is triggered, the application must reduce power consumption by releasing the activated resources, such as 3D, media, and sensors, which are no longer used. The released resources can be acquired again when theOnScreenOn() event handler is triggered.
You must handle the resources efficiently in the OnForeground(), OnBackground(), OnScreenOn(), andOnScreenOff() event handlers. Be careful not to duplicate or delete resources.
For example:
- When the touch panel auto-lock mode is enabled in the device, the OnBackground() event handler is called directly afterOnScreenOff().
- When the backlight time expires, the OnScreenOff() event handler is triggered. If the device is in the auto-lock mode,OnBackground() is called after OnScreenOff() when the lock UI is displayed.
- When the unlock key is pressed, if the touch lock is enabled, OnScreenOn() is triggered. TheOnForeground() event handler is called after the lock UI disappears.
- When the lock key is pressed, OnBackground() is called after the lock UI is displayed. When the backlight turns off,OnScreenOff() is called.
OnScreenOn() 和 OnScreenOff() 事件处理器使用方法如下:
void MyApplication::OnScreenOn (void) { //TODO:} void MyApplication::OnScreenOff (void) { //TODO:}
For more information on system events, see the API Reference.
- bada的系统事件
- bada的系统事件
- Hello Bada!详解之三:Bada的系统应用基础与Bada UI
- 三星整合Bada与Tizen系统 意在挖掘Bada社区
- Hello Bada!详解之二:Bada的C++命名空间
- Hello Bada!详解之四:Bada UI的布局
- bada debug的一些问题
- Bada项目的目录结构
- Bada学习-(十八)事件注入器(触发器)
- 让Bada的GlesCube11 Sample跑起来
- Bada学习-(十四)SDK的安装
- Bada实现中对控件的删除。
- 开源Tizen系统视频泄露 酷似MeeGo及Bada
- 开源Tizen系统视频泄露 酷似MeeGo及Bada
- Hello Bada!详解之一:系统框架与生命周期
- QT的事件系统
- QT的事件系统
- QT的事件系统
- linux获取本机IP地址问题(live555)
- 调用libvlc_media_player_stop经常会导致程序挂起
- Matlab常用函数举例(六)
- 学习x86时,自己写的一个引导,从实时模式到保护模式
- Jquery demo 地址 和 版本下载 地址
- bada的系统事件
- Time scale Duration
- 使用EventLog类写Windows事件日志
- Loadrunner Error code : 9013.
- S3C6410 IROM启动
- Linux中多线程编程并传递多个参数
- Matlab常用函数举例(七)
- openstack之swift 参考资料 总汇
- 前端性能