Search code examples
androidtizen

How to launch companion Android application from Tizen web application?


I am developing a Tizen web application and it has a companion app on an Android device.

I am trying to launch the Android application from the Tizen web app, but I am not sure why it is not launching. Using the code below, the Google Play Store of my companion app was successfully launched, but I want to directly launch the application.

var appid = "com.samsung.w-manager-service";
    var type = "phone";
    var url = "market://details?id=PackageName";
    var extra_data = [
              new tizen.ApplicationControlData("msgId", ["mgr_install_host_app_req"]),
              new tizen.ApplicationControlData("type", [type]),
              new tizen.ApplicationControlData("deeplink", [url])];
    var appControl = new tizen.ApplicationControl(
               "http://tizen.org/appcontrol/operation/default",
               null,
               null,
               null,
               extra_data);
    var appControlReplyCallback = {
            onsuccess: function(data) {
                console.log("launchUrl reply success");
                console.log("success: data = " + JSON.stringify(data));
            },
            onfailure: function() {
                console.log("launchUrl reply failed");
            }
        };
    try {
        tizen.application.launchAppControl(
                 appControl,
                 appid,
                 function() { console.log("intentBorba", "launchUrl success"); },
                 function(err) { console.log("intentBorba", "launchUrl failed: " + err.message); },
                 appControlReplyCallback);
    }catch(err) {
        console.error("[launcher] " + err);
    }

What should I give to the parameters to directly launch my companion application?


Solution

  • A remote application control (app control) is a way of interacting with a remote application installed on a remote host device.

    https://img-developer.samsung.com/onlinedocs/gear/web_device/webapis/remoteappcontrol.html

    Please try to use remote app control.