Hello everyone,
I am working an the Samsung Galaxy Watch Active 2 and I have generated on Tizen, the basic UI app with wearable 4.0.
my manifest:
privilege/location
feature/location.gps
feature/location.wps
feature/location
my basicui.c :
#include <locations.h>
location_manager_h location_manager;
location_service_state_e location_service_state = LOCATIONS_SERVICE_DISABLED;
...
void location_state_cb(location_service_state_e state, void *user_data)
{
if (state == LOCATIONS_SERVICE_ENABLED)
{
dlog_print(DLOG_INFO, LOG_TAG,"Location service enabled");
double altitude, latitude, longitude, climb, direction, speed;
double horizontal, vertical;
location_accuracy_level_e level;
time_t timestamp;
int err = location_manager_get_location(location_manager, &altitude, &latitude, &longitude,
&climb, &direction, &speed, &level,
&horizontal, &vertical, ×tamp);
if (err == LOCATIONS_ERROR_NONE)
{
dlog_print(DLOG_INFO, LOG_TAG,"GPS data good");
}
else
{
dlog_print(DLOG_INFO, LOG_TAG,"GPS data wrong");
//handle error here
}
}
if (state == LOCATIONS_SERVICE_DISABLED)
{
dlog_print(DLOG_INFO, LOG_TAG,"Location service disbaled");
}
}
void setup_location_manager()
{
if (location_manager_create(LOCATIONS_METHOD_HYBRID, &location_manager) == LOCATIONS_ERROR_NONE)
{
dlog_print(DLOG_INFO, LOG_TAG,"GPS created"); // being print
// Setting callback for state change
if(location_manager_set_service_state_changed_cb(location_manager, location_state_cb, NULL) == LOCATIONS_ERROR_NONE)
{
dlog_print(DLOG_INFO, LOG_TAG,"GPS callback added"); // being print
}
// Starting service
if(location_manager_start(location_manager) == LOCATIONS_ERROR_NONE) // returning LOCATION_ERROR_ACCESSIBILITY_NOT_ALLOWED
{
dlog_print(DLOG_INFO, LOG_TAG,"GPS started");
}
}
else {
dlog_print(DLOG_INFO, LOG_TAG,"GPS not created");
}
}
void destroy_location_service()
{
if (location_manager_unset_service_state_changed_cb(location_manager) == LOCATIONS_ERROR_NONE)
{
dlog_print(DLOG_INFO, LOG_TAG,"GPS unset cb error");
}
// It is not necessary to call location_manager_stop() just before calling
// location_manager_destroy because the service is stopped automatically
// before destruction.
if (location_manager_destroy(location_manager) == LOCATIONS_ERROR_NONE)
{
dlog_print(DLOG_INFO, LOG_TAG,"GPS destroyed");
location_manager = NULL;
}
}
static bool
app_create(void *data)
{
/* Hook to take necessary actions before main event loop starts
Initialize UI resources and application's data
If this function returns true, the main loop of application starts
If this function returns false, the application is terminated */
appdata_s *ad = data;
create_base_gui(ad);
setup_location_manager();
return true;
}
static void
app_terminate(void *data)
{
/* Release all resources. */
destroy_location_service();
}
With this basic code, I am having troubles to get my location datas. As you see in the file attachment, there is a picture of logs, and it shows that the location manager start didn't work because the permissions. Can you tell me if I am missing something ?? Thanks you very much for your futur help.