Languages

Menu
Sites
Language
[Wearable] Send "intent" to phone

Hi,

I'm trying to send an "intent" via tizen.application.launchAppControl from a Gear S to a paired Phone.

In case of just starting the galaxy store to show a specific app everything works fine, e.g.

var appid = "com.samsung.w-manager-service"
,   type = "phone"
,   url = "samsungapps://ProductDetail/appid"
,	extra_data = [
        new tizen.ApplicationControlData("type", [type]), 
      new tizen.ApplicationControlData("deeplink", [url])
    ]
,	appControl = new tizen.ApplicationControl(
       "http://tizen.org/appcontrol/operation/default",
       null,
       null,
       null,
       extra_data
)
,	appControlReplyCallback = {
		// callee sent a reply
 		onsuccess: function(data) {
 			console.log("launchUrl reply success");
 			console.log("success: data = " + JSON.stringify(data));
 		},
		// callee returned failure
	  	onfailure: function() {
	  		console.log("launchUrl reply failed");
	    }
	}
;
 
try {
	 tizen.application.launchAppControl(
		 appControl,
		 appid,
	     function() { console.log("launchUrl success"); },
	     function(err) { console.log("launchUrl failed: " + err.message); },
	     appControlReplyCallback
     );
} catch(err) {
	console.error("[launcher] " + err);
}

But if I try to use this for an intent of a costume app on the phone it's not working as expected.
As far as I interpreted the "adb catlog" of the phone  the url from deeplink is used as "intent.setData" what is ok, but I'm not able to set the intents action.
 

I/HMSAPProviderService( 1327): onDataAvailable() channelId=103, data [{ "msgId" : "mgr_install_host_app_req", "pkg_name" : "----------", "download_type" : "gear", "deeplink_url" : "my.intent.data://v1.0/52.52164,13.41087" }]

I/ActivityManager(  901): START u0 {act=android.intent.action.VIEW dat=my.intent.data://v1.0/52.52164,13.41087 flg=0x10000000 (has extras)} from uid 10214 on display 0

D/Instrumentation( 1327): checkStartActivityResult  :Intent { act=android.intent.action.VIEW dat=my.intent.data://v1.0/52.52164,13.41087 flg=0x10000000 (has extras) }
D/Instrumentation( 1327): checkStartActivityResult  inent is instance of inent:
W/System.err( 1327): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=my.intent.data://v1.0/52.52164,13.41087 flg=0x10000000 (has extras) }
W/System.err( 1327):    at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1801)
W/System.err( 1327):    at android.app.Instrumentation.execStartActivity(Instrumentation.java:1499)
W/System.err( 1327):    at android.app.ContextImpl.startActivity(ContextImpl.java:1545)
W/System.err( 1327):    at android.app.ContextImpl.startActivity(ContextImpl.java:1527)
W/System.err( 1327):    at android.content.ContextWrapper.startActivity(ContextWrapper.java:337)
W/System.err( 1327):    at com.samsung.android.hostmanager.jsoncontroller.PMJSONReceiver.handleInstallHostAppRequest(PMJSONReceiver.java:3308)
W/System.err( 1327):    at com.samsung.android.hostmanager.jsoncontroller.PMJSONReceiver.onDataAvailable(PMJSONReceiver.java:234)
W/System.err( 1327):    at com.samsung.android.hostmanager.jsoncontroller.JSONController.onDataAvailable(JSONController.java:49)
W/System.err( 1327):    at com.samsung.android.hostmanager.service.HMSAPProviderService.onDataAvailable(HMSAPProviderService.java:493)
W/System.err( 1327):    at com.samsung.android.hostmanager.connection.HMSAPSASocket.onReceive(HMSAPSASocket.java:352)
W/System.err( 1327):    at com.samsung.android.sdk.accessory.SASocket$ChannelCallback.onRead(SASocket.java:637)
W/System.err( 1327):    at com.samsung.accessory.api.SAServiceChannel$EventCallBackResultReceiver.onReceiveResult(SAServiceChannel.java:225)
W/System.err( 1327):    at android.os.ResultReceiver$MyRunnable.run(ResultReceiver.java:50)
W/System.err( 1327):    at android.os.Handler.handleCallback(Handler.java:739)
W/System.err( 1327):    at android.os.Handler.dispatchMessage(Handler.java:95)
W/System.err( 1327):    at android.os.Looper.loop(Looper.java:145)
W/System.err( 1327):    at android.os.HandlerThread.run(HandlerThread.java:61)

So the line with 

I/ActivityManager(  901): START u0 {act=android.intent.action.VIEW dat=my.intent.data://v1.0/52.52164,13.41087 flg=0x10000000 (has extras)} from uid 10214 on display 0

shows that it's trying to use "act=android.intent.action.VIEW" as action, but I should be something like "act=com.my.app.DOSOMETHING".

Does anybody know if it is even possible to use/call android intents from a Gear device?

 

The main goal is to use already implemented intents from an Android App in a wearable companion app. Otherwise we need to implement the also in our SAP communication. But it would be nice to use some of the already implemented stuff.

 

Regards
Stephan

Responses

8 Replies
Marco Buettner

Imo AppControls work only on the device and cannot use to start services on the android device... For that you have to use SAP

daniel kim

Hi,

I've searched it but could not find the way.

As you can send intents in your provider application of phone side, I suggest you to make it inside of it.

Regards.

Rodrigo Borba

I'm with the same doubt here. Any cahnges about it?

AVSukhov

hello,

i thisnk this is impossible for standalone app (no any info about this). the best way using companion type of app and send intent from your host app.

daniel kim

Hi,

   As I could not find it from official document, it seems that there is no way to achieve it.

   I think that you need to make it on your provider apk. do you have any requirement that you need to perform it on Gear side only?

Regards

Rodrigo Borba

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.

 

daniel kim

Hi,

It's great. I would suggest you to post your solution to code snippet for tizen folks.

   https://developer.tizen.org/community/code-snippet

Regards

Gaurav Singhal

Hi,

 

Thank You for the information.

It helped me a lot.