Subscription preference

Notification emails are sent to your Samsung account email address.

* Email : anonymous@samsung.com

  

Close

Not able to start bluetooth on Gear S3 with app control

Forums View
Started by Newbie mail , 610 Seed Jan 17, 2018 20:41 Replies : 7 View : 744 Likes : 0
Hello,
I'm want to build a app to turnoff and on bluetooth and wifi at a specific time.
I discovered that it is not possible to do this direct from programcode.
To my opinion this should be possible if the user gives the permission, like in Android where i can give permissions to selected apps.

Well this is not possible at the moment, may some developer of Samsung can change that.....

So after that, I tried to load instead the application control for Bluetooth.
But even this doesn't work for Bluetooth, for Wifi it does!

The return value from "app_control_send_launch_request" is
 APP_CONTROL_ERROR_LAUNCH_REJECTED  (-13)   -  The application cannot be launched now 

Help would be great!


Code

 int bt_onoff_operation(void) {

int ret = 0;
    app_control_h service = NULL;
    app_control_create(&service);

    if (service == NULL) {
        dlog_print(DLOG_INFO, LOG_TAG, "Failed to create app control handler");

        return -1;
    }
    //ret = app_control_set_operation(service, "org.tizen.bluetooth");
    //ret = app_control_set_app_id(service, "com.samsung.bluetooth");
        ret = app_control_set_operation(service, "com.samsung.bluetooth");
    ret = app_control_send_launch_request(service, NULL, NULL);
    app_control_destroy(service);

    if (ret == APP_CONTROL_ERROR_NONE) {
        dlog_print(DLOG_INFO, LOG_TAG, "Succeeded to launch!\n");

        return 0;
    } else {
        dlog_print(DLOG_INFO, LOG_TAG, "Failed to launch!\n");

        return -1;
    }

    return 0;
}


 

Post Reply
Board View
Samsung Developer shaswatimist , 46430 Seed Jan 18, 2018 05:13 Post #1 0
Please try the code snippet here in Enabling and Disabling Bluetooth section. Hope it'll fulfill your requirement. Please share the status here once you try this.
Post Reply
Board View
Newbie mail , 610 Seed Jan 18, 2018 15:21 Post #2 0


This content has been quoted from shaswatimist’s thought.

Please try the code snippet here in Enabling and Disabling Bluetooth section. Hope it’ll fulfill your requirement. Please share the status here once you try this.


Thanks for your Message.
I've tried all kind of different Codes i could found but nothing works.
What about the possibility to turn on and off Bluetooth directly from native code.
 
Post Reply
Board View
Samsung Developer shaswatimist , 46430 Seed Jan 19, 2018 05:24 Post #3 0
I've tried to test the code snippet in that link and it's working in Wearable device with tizen version 3.0.0.1. The same thing not working for version 2.3.2. May be this feature is supported from wearable 3.0.
Post Reply
Board View
Newbie mail , 610 Seed Jan 19, 2018 21:38 Post #4 0
Hi,
for me this code is not working.
What I found in the API Reference for  app_control_send_launch_request
Remarks:
    The function returns APP_CONTROL_ERROR_LAUNCH_REJECTED if the operation value is APP_CONTROL_OPERATION_LAUNCH_ON_EVENT which is only for handling the event from the platform or other application, 

refer to the Event module. 
    Since Tizen 3.0, the launch request of the service application over out of packages is restricted by the platform. Also, implicit launch requests are NOT delivered to service applications since 3.0. 

To launch a service application, an explicit launch request with application ID given by the app_control_set_app_id() must be sent.

I tried this with the following code and results


Code

 #
Platform wearable-3.0
Emulator w-3.0 circle

app_control_set_operation(service, APP_CONTROL_OPERATION_SETTING_BT_ENABLE);
ret = app_control_send_launch_request(service, NULL, NULL);
ret = -17825759 !Bluetooth - not working

#
Platform wearable-3.0
Emulator w-3.0 circle

app_control_set_operation(service, APP_CONTROL_OPERATION_SETTING_WIFI);
ret = app_control_send_launch_request(service, NULL, NULL);
ret = -17825759 !Wifi - not working

#
Platform wearable-3.0.0.1
SM-R760

app_control_set_operation(service, APP_CONTROL_OPERATION_SETTING_BT_ENABLE);
ret = app_control_send_launch_request(service, NULL, NULL);
ret = 0 !Bluetooth - not working

#
Platform wearable-3.0.0.1
SM-R760

app_control_set_operation(service, APP_CONTROL_OPERATION_SETTING_WIFI);
ret = app_control_send_launch_request(service, NULL, NULL);
ret = 17825759 !Wifi - not working

#
Platform wearable-3.0.0.1
SM-R760

app_control_set_operation(service, "com.samsung.wifi");
ret = app_control_send_launch_request(service, NULL, NULL);
ret = 17825759 !Wifi - not working

#
Platform wearable-3.0.0.1
SM-R760

ret = app_control_set_app_id(service, "com.samsung.wifi");
ret = app_control_send_launch_request(service, NULL, NULL);
ret = 0 !Wifi - !working!

#
Platform wearable-3.0.0.1
SM-R760

ret = app_control_set_app_id(service, "com.samsung.bluetooth");
ret = app_control_send_launch_request(service, NULL, NULL);
ret = -13 !Bluetooth - 
not working


 


Post Reply
Board View
Samsung Developer shaswatimist , 46430 Seed Jan 22, 2018 06:52 Post #5 0
Please turn off bluetooth before using app launch from your app. It works in this way in my SM-R765S. The same thing doesn't work if I keep bluetooth on and then try to launch.
Post Reply
Board View
Newbie mail , 610 Seed Jan 23, 2018 22:34 Post #6 0


This content has been quoted from shaswatimist’s thought.

Please turn off bluetooth before using app launch from your app. It works in this way in my SM-R765S. The same thing doesn’t work if I keep bluetooth on and then try to launch.


Ok, then it works on my S3 too.
But can you tell me how I give the my app the opportunity to turn Bluetooth off, or show the user the button to turn off?



Post Reply
Board View
Samsung Developer shaswatimist , 46430 Seed Jan 25, 2018 11:52 Post #7 0
How about Checking the Bluetooth Adapter State and if it's enabled then showing a message to the user through your own popup message to disable it from settings menu?
Post Reply