Device Rotation Status Check
The following native code snippet will check whether auto rotation status is on or off. It will return 1 if rotation is on and return 0 if rotation off.
#include<runtime_info.h>
#include<stdbool.h>
bool check_device_rotation_status()
{
//This variable will hold the current status of auto rotation.
bool status_code;
int ret;
// RUNTIME_INFO_KEY_AUTO_ROTATION_ENABLED key indicates whether auto-rotation is enabled or not.
ret = runtime_info_get_value_bool(RUNTIME_INFO_KEY_AUTO_ROTATION_ENABLED,&status_code);
if(ret != RUNTIME_INFO_ERROR_NONE)
{
/* Error handling */
dlog_print(DLOG_INFO,"TAG","Error");
return 0;
}
dlog_print(DLOG_INFO,"TAG","Auto Rotation State: %s",status_code ? "Enabled":"Disabled");
return status_code;
}