Security Privilege Error - Samsung Gear SAP

霸气de小男生 提交于 2020-01-23 12:24:07

问题


I'm following the Samsung SAP provider/consumer tutorial and I'm getting a security error when I run the connect() method:

function connect() {
    console.log("trying to connect");
    document.getElementById('label').innerHTML = 'trying to connect';
    if (SASocket) {
        alert('Already connected!');
        return false;
    }
    try {
        webapis.sa.requestSAAgent(onsuccess, onerror);
    } catch(err) {
        console.log("exception [" + err.name + "] msg[" + err.message + "]");
        document.getElementById('errorlabel').innerHTML = "exception [" + err.name + "] msg[" + err.message + "]";
    }
}

js/main.js (74) :exception [SecurityError] msg[The application does not have the privilege to call this method.]

In my config.xml I have:

<tizen:privilege name="http://devloper.samsung.com/privilege/accessoryprotocol"/?

Do I need anything else e.g. a certificate? I can run the sample projects no problem without my own certificate but do I need a certificate if I created the app myself from scratch?

Update - Solution: Two things - 1. typo! devloper should be developer - 2. @Nana Ghartey is also correct - a certificate is needed to test on the device, get this by sending a CSR to Samsung (details on their developer site).


回答1:


You only need to generate a certificate if you want to test your gear consumer widget apps on a real device. You don't need it when running on the emulator

You can find more information about certificates in the Help section of the IDE (Help Contents > Getting Started with Tizen Wearable > Development Environment > Tizen SDK for Wearable > Certificates).

Regarding the Privilege issue, the accessory protocol privilege is a public level privilege that allows apps to use SAP to connect and transfer files between gear and host devices. I faced no problems using this privilege.

Perhaps, line 74 in main.js requires a Partner/Platform privilege. Note that install apps on commercial devices, develop apps only with public level privileges. Privileges are categorized into three levels based on their security impact:

Public

These privileges are open to all Tizen application developers.

Partner

These privileges can only be used by developers registered as partners on the Tizen store.

The developer must be fully identified and permitted by the partner policy of the Tizen Store to use both public and partner level privileges.

Platform

These privileges are used in system APIs for managing the Tizen platform.

These privileges are open only to a specific set of Tizen application developers.

For more info check out the Security Architecture guide



来源:https://stackoverflow.com/questions/24139075/security-privilege-error-samsung-gear-sap

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!