Android Question NFC reading - can the default read notification sound be removed.

davemorris

Active Member
Licensed User
Longtime User
Hi Guys
I have a question regarding the sound produced when a NFC tag is read (which appears to be generated by the OS) - Can it be removed or changed?

I think it maybe useful to give the reason why I am asking this question - As removing a feedback sound which helps the user to know something has happened is usually not a good idea.

In my application reading of the NFC involves two operations.
1. First operation is reading the device (the sounds are generated here by the OS).
2 The second operation (after a successful read) is to verify that the Tag is correctly setup to work with my app.

Its the second stage the sounds need to be generated (not the first) - basically Accept or Reject sounds.

My solution is based on Erel example see https://www.b4x.com/android/forum/threads/nfc-reading-and-writing.64451/#content
and intercepts the NFC intent.

In another post from Erel, he suggested using software from NXP https://play.google.com/store/apps/details?id=com.nxp.nfc.tagwriter to test the Tags. Interestingly, this appears to have the same problem (or so it appears to me) but manages to overlay the default NFC read sound with a more suitable Accept/reject sounds.

I would be grateful for any suggestions.

Dave Morris
 
Solution
Example that uses the reader mode API, instead of the intent based API. It allows disabling the platform sounds.
Note that it supports writing as well.

It is almost identical to the NFC example.

davemorris

Active Member
Licensed User
Longtime User
Hi Erel

Thanks your example Read mode API works great, I can just add the sounds were I want them.

Also it appears the Read mode API approach works better with B4Xpages - as the Intent API caused the B4Xpages_Appear event to fire (which happened every time a NFC tag was read). I found in my application this proved to be counter productive and I had to add code to help the Page determine if it was called by a statement like ShowPage(...) or was invoked by the NFC intent. Perhaps, its just my style of coding - I think I should re-read/view the B4XPages documentation/examples to ensure I am using the B4Xpages framework correctly.

Kind regards
Dave Morris
 
Last edited:
Upvote 0

Uitenhage

Member
Licensed User
Longtime User
I am using the Reader Mode to read NFC because it can silence the sound. How can I make it not vibrate too?
 
Upvote 0

drgottjr

Expert
Licensed User
Longtime User
google's android documentation mentions nothing in regard to vibrations when a tag is discovered. only sounds. you may have to disable haptics in your device settings. with luck you might be able to do this on a per app basis.
 
Upvote 0

Similar Threads

Replies
1
Views
688
  • Question
Android Question NFC reader
Replies
1
Views
2K
Replies
64
Views
48K
Top