Hi Team,
I am trying to access NFC HCE feature in Samsung galaxy S3 Gear smart watch Near Field Communication (NFC) | Tizen Docs but nfc adapter is not able to listen the addHCEEventListener
event function when I bring smart watch close to NFC mobile reader.
Function to enable HCE is
(function () {
var hceListenerId = 0;
var adapter = tizen.nfc.getDefaultAdapter();
adapter.cardEmulationMode = 'ALWAYS_ON';
var successCB = function() {
alert('sending adpu response was successful')
console.log('Sending APDU response was successful.');
};
var errorCB = function() {
alert('sending adpu response was failed');
console.log('Sending APDU response failed.');
};
hceListenerId = adapter.addHCEEventListener(function(event_data) {
alert('inside the listner', JSON.stringify(event_data));
if (event_data.eventType == 'ACTIVATED') {
console.log('HCE activated');
window.alert("HCE activated");
} else if (event_data.eventType == 'DEACTIVATED') {
console.log('HCE deactivated');
window.alert("HCE deactivated");
} else if (event_data.eventType == 'APDU_RECEIVED') {
console.log('APDU received');
window.alert('APDU received');
var apdu_response = [0x00, 0xA4, 0x04, 0x00, 0x04, 0x11, 0x12, 0x13, 0x14];
adapter.sendHostAPDUResponse(apdu_response, successCB, errorCB);
}
});
alert( JSON.stringify(adapter));
alert(hceListenerId);
}());
Since remote logging is not working so have to rely on alert to know the value.
Adapter log is
hceListenerId is
and to know register AID i have used getAIDsForCategory function and value is
Despite all these stills the adapter addHCEEventListener
listner is not working when NFC mobile reader is closer to the watch. Any suggestion to resolve the issue would be highly appreciated.
I am tagging other similar issues for detailed insight.
1- Tizen Wearable Web SDK - HCE Event Not Detected | Tizen Developers
2 - https://developer.tizen.org/ko/forums/general-support/gear-s2-nfc-hce-problem?langswitch=ko
Note : I am building HCE for other
category but since getAIDsForCategory
function was not detecting so I changed the AID to payment
in aid.xml file which contents all AID tags.