Languages

Menu
Sites
Language
Native service packaged with native watch face

Hello, is there any way how I can package a native service into a native watch face?

When I use multi package, the watch face cannot be set. I do not receive any error in logs, when I set a breakpoint to the beginning of the main function in watch face, it never reached that breakpoint, so the watch face is not getting started at all.

When I removed the service from the package, it works well. I also tried it with freshly created, empty service, and my service is tested with other native app where everything works like it should, so there is probably no problem in the service, nor the watch face.

I have every privilege I need.

 

I am getting really frustrated developing on this platform, the IDE is awful and slow as hell, I have to restart emulators or even physical devices too often...

Responses

11 Replies
Shaswati Saha

The reason behind this is Watch Applications can't be launched by the Debug As option. There's no problem with your applications I guess. Please go through this link to debug watchface app. Hope it'll help you.

Vydra

thank you, however, Debug as was kind of "last resort" option in this case,

Before debugging, I've tried to install it normally several times and it did not work both on emulator or physical gear s3 device.

Interesting thing is, that when I run it on physical device (via Run as), it starts somehow like a normal app (when I press the back button, it exits and goes to normal watch face that is set). The problem occurs only after I try to set it as watch face.

So I will try to summarize it, if it is not clear.

  1. I run the app (via Run as command)
  2. It launches like a normal application and everything works like a charm
  3. I close it
  4. I try to set it as watch face
  5. Device freezes for 2-3 seconds
  6. Previous watch face appears
Shaswati Saha

I've tried to test this scenario with watchface and service app(both wearable 2.3.2) into my Gear S3 (Tizen version 3.0.0.1) and yes you're right. Watchface doesn't launch if it's packaged with a native service app. May be it's a bug. According to this link, watchface app is allowed to package with multiple service app.

Vydra

Thank you for your time, probably it is a bug. I will check if it has been reported and report it if it has not.

Sam Richardson

Any luck with this bug? I'm trying to get a service app to start automatically and thought launching it from a native watchface woudl be the way to go (using Tizen version 3.0.0.2 on Gear S3 with Wearable 3.0).

When I package the native watch application and service app together and explicitly launch the service with app_control it works upon installation from Tizen Studio. However, subsequent launches of the watchface simply hang and get killed.

So I guess the Tizen development team really do not want to allow this type of functionality. Also the link referred too in Shaswati Saha's post still shows that packaging a watch app with a service app should still be possilbe..

 

 

K Johnson

Please add below line of code in watch app manifest file.

<watch-application ambient-support="true" appid="YOUR_APP_ID" exec="YOUR_APP_EXEC" mainapp="true">

Though it'll give an error in manifest editor, ignore that and keep launching the app with error. Now it'll not create the problem you've mentioned above. It works in my case. Please check, hope it'll help.

Sam Richardson

Thanks for the tip. I gave this a try and launched the watch app (packaged with my main service_app) with the same behavior. It works fine upon installation and then the watchface disappears while the service-app keeps running. If i restart the watch and/or simply relaunch the watch app, it hangs and gets killed. I think the devil is in the details here and maybe you have some other setting set somewhere in either the watch or your main service app.. What's just strange is that it works upon installation and fails afterwards. 

This is my watch app manifest:
======================

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<manifest xmlns="http://tizen.org/ns/packages" api-version="2.3.2" package="watch.package" version="1.0.0">
    <profile name="wearable"/>
    <watch-application ambient-support="true" appid="watch.package" exec="service-app" main-app="true">
        <label>watchapp</label>
        <icon>watchapp.png</icon>
    </watch-application>
    <privileges>
        <privilege>http://tizen.org/privilege/appmanager.launch</privilege>
    </privileges>
</manifest>

 

And the service-app manifest:
======================

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<manifest xmlns="http://tizen.org/ns/packages" api-version="3.0" package="watch.package.service-app" version="1.0.0">
    <profile name="wearable"/>
    <service-application appid="watch.package.service-app" auto-restart="false" exec="watch.package.service-app" multiple="false" nodisplay="true" on-boot="false" type="capp">
        <label>service-app</label>
        <icon>service-app.png</icon>
        <app-control>
            <operation name="http://tizen.org/appcontrol/operation/main"/>
        </app-control>
        <app-control>
            <operation name="http://tizen.org/appcontrol/operation/launch_on_event"/>
        </app-control>
        <app-control>
            <operation name="http://tizen.org/appcontrol/operation/default"/>
        </app-control>
        <background-category value="sensor"/>
    </service-application>
    <privileges>
        <privilege>http://tizen.org/privilege/mediastorage</privilege>
        <privilege>http://tizen.org/privilege/healthinfo</privilege>
    </privileges>
    <feature name="http://tizen.org/feature/sensor.accelerometer">true</feature>
</manifest>

K Johnson

My watch app manifest file is as below:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<manifest xmlns="http://tizen.org/ns/packages" api-version="3.0" package="org.example.watch_service" version="1.0.0">
    <profile name="wearable"/>
    <watch-application ambient-support="true" appid="org.example.watch_service" exec="watch_service" mainapp="true">
        <label>watch_service</label>
        <icon>watch_service.png</icon>
    </watch-application>
    <privileges>
        <privilege>http://tizen.org/privilege/appmanager.launch</privilege>
        <privilege>http://tizen.org/privilege/alarm.set</privilege>
    </privileges>
</manifest>

As well as service app manifest looks like:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<manifest xmlns="http://tizen.org/ns/packages" api-version="3.0" package="org.example.service_watch" version="1.0.0">
    <profile name="wearable"/>
    <service-application appid="org.example.service_watch" exec="service_watch" multiple="false" nodisplay="true" taskmanage="false" type="capp">
        <label>service_watch</label>
        <icon>service_watch.png</icon>
        <background-category value="background-network"/>
    </service-application>
</manifest>

Would you please try again keeping your project manifest file similar to mine? 

K Johnson

Hi R Keanan,

What's the status right now? Could you solve it?

Sam Richardson

Hi K Johnson,

Unfortunately, still no luck. I think it has to do with the fact that my service has a sensors background category. 

I finally just ended up using an alarm service to launch a UI app (since launching a service app with an alarm is also not allowed). This UI app in turn launches my service app. This is not a very elegant approach but the only one that I could get working.

Maybe someone from the Tizen Wearables development team can confirm the issue. 

Cheers.

K Johnson

Would you please try with sample watch app and service app (not including any type of sensor data reading or anything else)? Just launch a service app from watch app using AppControl API and share the status here.