如何判断Tizen装置在车载设备的活动代码
这个代码显示了如何识别Tizen装置在车上的活动#include <activity_recognition.h>
...
bool supported = false;
activity_is_supported(ACTIVITY_IN_VEHICLE, &supported);
if (!supported) {
// Not supported
}
...
activity_h handle;
result = activity_create(&handle);
if (result != ACTIVITY_ERROR_NONE) {
// Error
}
result = activity_start_recognition(handle, ACTIVITY_IN_VEHICLE, activity_cb, NULL);
if (result != ACTIVITY_ERROR_NONE) {
// Error
}
...
void activity_cb(activity_type_e type, const activity_data_h data, double timestamp, activity_error_e error, void *user_data)
{
int result;
if (error != ACTIVITY_ERROR_NONE) {
// Error
return;
}
if (type == ACTIVITY_IN_VEHICLE) {
// ...
}
}
...
activity_stop_recognition(handle);
activity_release(handle);
页:
[1]