Languages

Menu
Sites
Language
Web app widget - companion using accessory protocol

hi,

I'd like to prepare an app in form of  a widget for Gear S2/S3 but it needs to receive some data from the phone.
Can I write a companion app using Samsung accessory protocol ?

Actually, I have a companion app supplying the data and I tried communicating with it through the web widget.
But it seems that the widget is not calling the accessory protocol.

Is this a limitation of the widget type apps ?

Thanks
 

Responses

8 Replies
Iqbal Hossain

hi, Web Widget has a parent web app.... try to communicate with that app from companion app. And pass the value from web app to web widget. 

mekabe remain

hi,

good idea. But where can I find information on writing a parent web app ?

I can't find info anywhere.

If you mean in the same wgt , using the index.html on parent directory of widget, I can write a web app there. But in any case my config.xml includes the master-app information and it should ask for installing the master app. It didn't when I tried the widget. (?)

Iqbal Hossain

hi, every widget comes with a parent app... widget can't run individually in Tizen. Under widget folder you can put multiple widget and communicate with parent app.. 
If you deploy widget, you will see an app on the app list. For example in my example case, you will see an app called 'AppShortcutsWidget' on the app list as the app name is this. This is the parent application. There is a api to communicate among widgets and web appli

mekabe remain

can I do this with wearable profile 2.3.0 ?

because when I try to use 2.3.2 , Tizen Studio doesn't accept my device certificate and I am not able to use a new one.

(see this post : https://developer.tizen.org/forums/sdk-ide/tizen-studio-certificate-manager-profiles.xml#comment-26982 )

 

And on 2.3.0 , I got this problem :

ide is throwing an error for the following widget configuration in config.xml

What may be wrong here ?

 

    <tizen:app-widget id="afgc92eoOp.testapp.testwidget" primary="true">
        <tizen:widget-label>Test Widget</tizen:widget-label>
        <tizen:widget-content src="widget/testwidget/index.html">
            <tizen:widget-size preview="widget/testwidget/preview.png">2x2</tizen:widget-size>
        </tizen:widget-content>
    </tizen:app-widget>

 

on tizen:widget-label , it says :

Invalid content was found starting with element 'tizen:widget-label'. One of '{"http://tizen.org/ns/widgets":box-label}' is  expected.

-----

and I still could not find how to communicate between parent app and widget. do you know any documentation ?

mekabe remain

ok. I got that.

And I tried to do an app with widget now. It is working.

However, I couldn't figure out how to pass variables between the parent app and the widget.

Is it documented somewhere ?

 

and the ide is throwing an error for the following widget configuration in config.xml

What may be wrong here ?

 

    <tizen:app-widget id="afgc92eoOp.testapp.testwidget" primary="true">
        <tizen:widget-label>Test Widget</tizen:widget-label>
        <tizen:widget-content src="widget/testwidget/index.html">
            <tizen:widget-size preview="widget/testwidget/preview.png">2x2</tizen:widget-size>
        </tizen:widget-content>
    </tizen:app-widget>

 

it says :

Invalid content was found starting with element 'tizen:widget-label'. One of '{"http://tizen.org/ns/widgets":box-label}' is 
 expected.

mekabe remain

in fact here:

https://developer.tizen.org/development/guides/web-application/application-management/applications/widget-application#comm_host

 

it says that web widget can communicate with Android host app. So a parent app is not required in my case.

But when I do as described under section "Communicating with a Host Application on a Host Device" , my widget does not connect to the Android host and retrieve data.

There's just one point that I am unable to do:

the document on that page says that I should add priviledge:

    <tizen:privilege name="http://developer.samsung.com/privilege/accessoryprotocol"/>

in my app, I have the line

    <tizen:privilege name="http://developer.samsung.com/tizen/privilege/accessoryprotocol"/>

in config.xml (parent)

 

and when I try to add

    <tizen:privilege name="http://developer.samsung.com/privilege/accessoryprotocol"/>

I get a signature error installing the app.

So I am not sure which one is correct. 

Btw, should I use a config.xml separate for the widget ?

 

mekabe remain

now the situation:

I need to get some information to my widget from the host app on Android mobile.

My initial method was to directly get info from the Android app to the Widget.

But I couldn't do it as I wrote in my previous post (I don't know why it doesn't work)

So, I am trying the other method as suggested in this thread by Iqbal Hossain

Android companion -> SAP-> Tizen Web App (parent) -> Tizen Web widget

In this method, the parent app gets the data. 

And I finally managed to get it from the parent to the widget using preferences API.

But , I couldn't figure out how to do it continuously. How can I make the parent app run in background when I open/use the widget ?

Is there a way to call parent app in background (shouldn't open in front of the widget) when the widget is selected (using visibility listener)  ? 

 

Btw, I prefer to use direct (Android to Widget) communication if that is possible.  Any ideas on that ?

 

These are the documentation I found so far:

https://developer.tizen.org/development/api-references/web-application?redirect=/dev-guide/latest/org.tizen.web.apireference/html/w3c_api/w3c_api_w.html#widget

https://developer.tizen.org/development/guides/web-application/application-management/application-preferences

https://developer.tizen.org/development/guides/web-application/application-management/application-information-and-controls/widget-information

mekabe remain

isn't there anyone who has similar experience ?

 

thanks