找回密码
 立即注册
查看: 2808|回复: 0

如何判断Tizen装置在车载设备的活动代码

[复制链接]
发表于 2016-4-17 09:37:07 | 显示全部楼层 |阅读模式
这个代码显示了如何识别Tizen装置在车上的活动

  1. #include <activity_recognition.h>
  2.     ...
  3.     bool supported = false;
  4.     activity_is_supported(ACTIVITY_IN_VEHICLE, &supported);
  5.     if (!supported) {
  6.         // Not supported
  7.     }
  8.     ...
  9.     activity_h handle;
  10.     result = activity_create(&handle);
  11.     if (result != ACTIVITY_ERROR_NONE) {
  12.         // Error
  13.     }
  14.     result = activity_start_recognition(handle, ACTIVITY_IN_VEHICLE, activity_cb, NULL);
  15.     if (result != ACTIVITY_ERROR_NONE) {
  16.         // Error
  17.     }
  18.     ...
  19.     void activity_cb(activity_type_e type, const activity_data_h data, double timestamp, activity_error_e error, void *user_data)
  20.     {
  21.         int result;
  22.         if (error != ACTIVITY_ERROR_NONE) {
  23.            // Error
  24.             return;
  25.         }

  26.         if (type == ACTIVITY_IN_VEHICLE) {
  27.             // ...
  28.         }
  29.     }
  30.     ...
  31. activity_stop_recognition(handle);
  32. activity_release(handle);
复制代码
欢迎来到泰泽网:http://www.tizennet.com/ 泰泽论坛:http://bbs.tizennet.com/ 好没有内涵哦,快到设置中更改这个无聊的签名吧!
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|泰泽应用|泰泽论坛|泰泽网|小黑屋|Archiver|手机版|泰泽邮箱|泰泽网 ( 蜀ICP备13024062号-1 )

GMT+8, 2024-4-26 15:38 , Processed in 0.058910 second(s), 20 queries .

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表