언어 설정

Menu
Sites
Language
Tizen Wearable Web SDK - HCE Event Not Detected

Hi,

 

We are developing a standalone tizen wearable web app for Samsung Gear S2.

We need to incorporate Host Card Emulation functionality in it.

We have followed the link

https://developer.tizen.org/development/tutorials/web-application/tizen-features/communication/nfc

https://developer.tizen.org/development/guides/web-application/tizen-features/communication/nfc

 

When we deployed the application to Gear S2, the control does not come to addHCEEventListener() function.

JS code

( function () {
  
	var hceListenerId = 0;
	var adapter = tizen.nfc.getDefaultAdapter();
	try {
		adapter.cardEmulationMode = "ALWAYS_ON";
	}
	catch(e)
	{
		console.log(e.name + ":  " + e.message);
	}
	
	try {
			hceListenerId = adapter.addHCEEventListener(function(event_data)
			{
			   if (event_data.eventType =="ACTIVATED")
			   {				  
				   window.alert("HCE activated");
			   }
			   else if (event_data.eventType =="DEACTIVATED")
			   {				   
				   window.alert("HCE deactivated");
			   }
			   else if (event_data.eventType =="APDU_RECEIVED")
			   {				  
				   window.alert("APDU received");				  	 
			   }
			});	
	}
	catch (error)
	{
		console.log("AddHCE Exception - " + error.name + ":" + error.message);
	}
} () );

config.xml

<?xml version="1.0" encoding="UTF-8"?>
<widget xmlns="http://www.w3.org/ns/widgets" xmlns:tizen="http://tizen.org/ns/widgets" id="http://yourdomain/NFCCardPoc" version="1.0.0" viewmodes="maximized">
    <tizen:app-control>
        <tizen:src name="index.html"/>
        <tizen:operation name="http://tizen.org/appcontrol/operation/nfc/transaction"/>
    </tizen:app-control>
    <tizen:app-control>
        <tizen:src name="index.html"/>
        <tizen:operation name="http://tizen.org/appcontrol/operation/nfc/host_apdu_service"/>
    </tizen:app-control>
    <tizen:application id="ehMGP0bX15.NFCCardPoc" package="ehMGP0bX15" required_version="2.3"/>  
    <content src="index.html"/>
    <feature name="http://tizen.org/feature/screen.size.normal"/>
    <feature name="http://tizen.org/feature/network.nfc"/>
    <feature name="http://tizen.org/feature/network.nfc.card_emulation"/>
    <feature name="http://tizen.org/feature/network.nfc.card_emulation.hce"/>
    <icon src="icon.png"/>
    <tizen:metadata key="http://tizen.org/metadata/nfc_cardemulation" value="wallet.xml"/>
    <name>NFCCardPoc</name>
    <tizen:privilege name="http://tizen.org/privilege/application.launch"/>
    <tizen:privilege name="http://tizen.org/privilege/nfc.common"/>
    <tizen:privilege name="http://tizen.org/privilege/nfc.admin"/>
    <tizen:privilege name="http://tizen.org/privilege/nfc.cardemulation"/>
    <tizen:profile name="wearable"/>
    <tizen:setting background-support="disable" encryption="disable" hwkey-event="enable"/>
</widget>

 

Is wallet.xml needed for this. We have given this but we do not know the significance of this. Can anybody help on this?

Is HCE supported in wearable web?

Or is there any steps that we missed.

 

Thanks in Advance

Responses

5 댓글
daniel kim

Hi,

According to this link, it seems that the access to hce is not opened to public developer and need to contact Samsung.

     https://developer.tizen.org/forums/general-support/gear-s2-eseembeded-secure-element%EC%97%90-access-%ED%95%98%EB%8A%94-%EB%B0%A9%EB%B2%95%EC%9D%84-%EB%AC%B8%EC%9D%98-%EB%93%9C%EB%A6%BD%EB%8B%88%EB%8B%A4.?tab=active

I would suggest you to ask your query to seller site.

   https://help.content.samsung.com/csseller/main/main.do

Regards

 

Tintu Thilak

Hi,

 

An update on this

Since our console.logs are not printed, we were not able to see the error caught in catch block.

We tried this on a button click. So we were able to see the error.

 

The error is thrown from the following line

adapterHCE.cardEmulationMode = "ALWAYS_ON";

 

The error is

message: "UnknownError"
name: "UnknownError"
sourceURL: "file:///opt/usr/apps/ehMGP0bX15/res/wgt/app.js"
stack: "startHCE@file:///opt/usr/apps/ehMGP0bX15/res/wgt/app.js:26:15↵file:///opt/usr/apps/ehMGP0bX15/res/wgt/app.js:42:11"
type: "UnknownError"

Tintu Thilak

When we changed the required_version in config.xml to 2.3.1, the "UnknownError" is no more displayed.

 

We were able to register AID successfully for 'Other' category.

But the HCE event is not detected by Gear S2. The card reader (an app in Android) is able to detect Gear S2 and sending a request.

But the same request is not detected by Gear S2. The control does not go to the success call back of HCEeventlistener and we are not able to proceed further.

 

We are using privilege as 'Partner' and Developer Type as 'Individual'.

Can anyone help us in resolving this issue

daniel kim

Hi,

According to this link, it seems that you need a contract with Samsung.

   https://developer.tizen.org/forums/general-support/gear-s2-eseembeded-secure-element%EC%97%90-access-%ED%95%98%EB%8A%94-%EB%B0%A9%EB%B2%95%EC%9D%84-%EB%AC%B8%EC%9D%98-%EB%93%9C%EB%A6%BD%EB%8B%88%EB%8B%A4.?tab=active

So I would suggest you to ask your query to this board.

  https://help.content.samsung.com/csseller/main/main.do

Regards

Luca Visconti

We have the same problem. I think that it's a bug (in our code or in Tizen), we are not trying to access to the secure element, we are trying to use the host card emulator, a simple way to exchange data via NFC.

We have written similar code for Android with no need of special permissions.

@Tintu Thilak

Did you have any success?