Languages

Menu
Sites
Language
Start tizen native service from web app

Hi.


I have two applications: native service app written in C, that runs in background and web-based watch face app. I want to start my service app from the watch face app. This is my code:

 

var appId = "com.companyname.appname";

tizen.application.launch(appId, function() {

    console.log("app opened");

}, function(e) {

    console.log("error " + e.type + " msg:" + e.message);

});

 

This code is not working and the error says "error undefined msg:Unknown error has occurred".

But if I change the appId to "com.samsung.weather" then its working fine. It opens the weather app. So i guess I'm giving a wrong appId. But I've checked with this code:

 

tizen.application

    .getAppsInfo(function onListInstalledApps(applications) {

        console.log("APPS INSTALLED:");

        for (var i = 0; i < applications.length; i++)

            console.log(i + " ID: " + applications[i].id);

        });

 

and it displays exactly the same ID that I was using above (the id of my native service app).

I've also tried with command tool sdb to list installed apps and it gave me the same ID....

Why it's not working?

Edited by: Damian Michalak on 23 May, 2018
View Selected Answer

Responses

4 Replies
André Reus

hi, You may use message port to package your web and native service app together . It will make single wgt file.  

1. https://developer.tizen.org/community/tip-tech/sending-bundle-over-message-port

2. https://developer.tizen.org/community/tip-tech/communication-within-tizen-hybrid-app

And in your current case, may be this is permission issue ... did you add the privileges ? 

Damian Michalak

Hello André. Thank you for the response.

 

I have following permissions to my app:

 

    <tizen:privilege name="http://tizen.org/privilege/application.launch"/>

    <tizen:privilege name="http://tizen.org/privilege/application.info"/>

 

But when I added this permission:

    <tizen:privilege name="http://tizen.org/privilege/appmanager.launch"/>

I was unable to run the app on my device. There was an error saying:

Launching 'DigitalWatch' has encountered a problem. The application installation on the device failed due to signature error! You need an appropriate certificate profile, which can be created or activated in the Certificate Manager.

 

But how is it that launching the samsung weather app works fine, but launching my own app does not work??

Mark as answer
André Reus

hi Damian Michalak, you may follow provided links above to build your web app along with your native service. I think problem is web app can't find the native service! 

Damian Michalak

Thank you for the suggestion. I used multipackage to add native service app to web app and it's working fine now!