Galaxy gear s2 - Launche android application on phone from Tizen Web Application

579 Views Asked by At

I'm trying to figure out how to send some kind of intent to open an application on the Android Device that is synced with my Tizen Wearable. Any tips about it?

I found this link. With this code I'm able to launch the Samsung Store. I need to launch Google Play. I already tried to replace the appid for: com.android.vending

https://developer.tizen.org/ko/forums/web-application-development/wearable-send-intent-phone?langswitch=ko

1

There are 1 best solutions below

0
On BEST ANSWER

after alot of research and some "reverse engineering" in the Nike Tizen Application (which opens the Google Play Store) I was able to open differente applications.

window.onload = function() {
    var appid = "com.samsung.w-manager-service";
    var type = "phone";
    var url = "market://details?id=br.org.cesar.punchcardreminder";

    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);
    }
};

It's kind of frustrating figure out that there is not directly documentation of a such simple feature when you're starting to develop in a new language. I hope that this answer helps some people.