NFC_manager flutter package reading NFC not work in android - android

I've followed 'NFC_manager' example, https://pub.dev/packages/nfc_manager/example
Successfully build in my android phone and check NFC instance avaiable when I turn on NFC mode.
Howerver, clicking the 'Tag Read' button, it should be started to scan NFC tags.
photo-1
But 'NFC_manager' cannot catch any tag.
After some time past, below error message appear in the text box as below photo.
photo-2
Is there anything else I missed?

Related

RhoMobile on TC52, Android 8.1: "DS8178 Bluetooth Scanner is not connected ..."

I am trying to get an existing RhoMobile APK running on a TC52, Android 8.1.
The App is running fine on TC51, Android 6. On the TC52, when i start the app I get a toast message
DS8178 Bluetooth Scanner is not connected, therefor BTPairing Utility will be started.
The problem is that - ignoring the BTPairing Utility App (i also tried to disable it) - i cant use the build in scanner in my rho mobile app. When I try to use it I see the following message in the log
"The decodeSound barcode property can only be set once the scanner has finished initialising"
Looking at the underlying code, it looks like that the scanner has not initialised, probably due to not be able to pair the bluetooth scanner. But there is now such scanner and there never will be. Anybody know how to disable this behaviour?
Edit 1:
Here is my javascript code for enabling the scanner
Rho.Barcode.enable({ allDecoders: true }, this.onScan);
But, I think it happens before that javascript is accessed; the app is hosted on web server; even if i disable WIFI and starting the app, the toast is displayed. It seems like that RhoMobile is trying to setup all known scanners.
Edit 2:
When I enumerate all scanners, i get those in this order
Scanners found: '[
"Camera Scanner",
"2D Barcode Imager",
"Bluetooth Scanner",
"RS6000 Bluetooth Scanner",
"DS3678 Bluetooth Scanner",
"LI3678 Bluetooth Scanner",
"DS2278 Bluetooth Scanner",
"DS8178 Bluetooth Scanner"]'
Default scanner: '2D Barcode Imager'
Default scanner is determined by
Rho.Barcode.getProperty("friendlyName");
Edit 3:
Ok, as suggested in the comments, using the actual instance returned from the enumeration works; triggering scanner buttons works well.
What remains is the toast that asks to connect the DS8178 Bluetooth Scanner; is there a way to disable scanners from config.xml?
This error:
DS8178 Bluetooth Scanner is not connected, therefor BTPairing Utility will be started.
Is not coming from RhoMobile, it is being generated from the low level scanning framework. I checked on a more up to date device and I'm glad to say they fixed the spelling error. It is caused when something (either EMDK or DataWedge) tries to enable the DS8178 scanner. The DS scanner support was only added in a recent version of the mobile computing scanner framework so that probably explains the difference in behaviour you are seeing between TC51 and TC52.
RhoMobile (on Zebra Android devices) wraps the EMDK and exposes each supported scanner as a separate Barcode object and you can see all of these in the array returned from enumerate. What is strange is that, per your second edit, the default scanner is '2D Barcode Imager'.
There are a few options / possibilities:
There is a bug in the RhoMobile framework and for some reason the DS8178 scanner is being enabled. I checked https://github.com/rhomobile/rhodes/tree/master/lib/commonAPI/barcode/ext/platform/android/src/com/rho/barcode and cannot see any such bug. Rho is open source but supported by Tau-Technologies if you wanted to explore that route.
Something else on your device is enabling the DS8178 scanner, e.g. a DataWedge profile or other app using the EMDK. You could disable DataWedge (from the DataWedge app settings) and reboot your device to test this.
There is an issue with the TC52. I would say this is the least likely as I have never heard of a similar issue
There is no way to disable any of the scanners via XML

How can a user can execute my NFC code without downloading my App?

How can a user execute my NFC code without downloading my app?
The following code works so long as I have my app installed. However, in the real world, a user won't have my app installed. Rather I just want this code to execute just by scanning a Passive NFC tag. Code follows:
#Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
if(intent.hasExtra(NfcAdapter.EXTRA_TAG))
{
Toast.makeText(this, "NfcIntent!", Toast.LENGTH_SHORT).show();
Tag tag = intent.getParcelableExtra(NfcAdapter.EXTRA_TAG);
SmsManager sms = SmsManager.getDefault();
sms.sendTextMessage("5555555555", null, "Hello Folks", null, null);
NdefMessage ndefMessage = createNdefMessage("Hi! I am tag #1");
writeNdefMessage(tag,ndefMessage);
}
}
I'm just trying to send a text message from the user's phone to a predetermined number with a hard-coded message...thanks so much for any help.
How can a user execute my NFC code without downloading my app?
The code cannot be executed without the app.
The following code works so long as I have my app installed. However, in the real world, a user won't have my app installed.
Taken from this website:
"NFC tags are passive, meaning they don't have any power source. Instead, they literally draw power from the device that reads them, thanks to magnetic induction. When a reader gets close enough to a tag, it energizes it and transfer data from that tag."
This means they transfer data - they cannot execute code. You can transfer code, but the code will not do anything. The exception is if you have a custom app to recieve code to then execute it - but who has an app like that installed with their phone?
From this website:
"At the time of writing the NFC standard has three modes of operation: the peer-to-peer mode that lets two smartphones swap data, a read/write mode in which one active device picks up info from a passive one, and card emulation, in which an NFC device such as a smartphone can be used like a contactless credit card."
This means that as of now, the action you described:
Rather I just want this code to execute just by scanning a Passive NFC tag.
Is not possible without custom software. Which again means - the user has to install your app. and then the point is lost. In addition, I don't think they will open to code being executed by NFC tags, as it creates a massive security vounerability.
So as of writing, you have to promt the second user to install the app for it to work(if phone to phone transfers is what you are trying to do).

Hide "NFC Tag type not supported" error on Samsung Galaxy devices

I am working on an app that scans just the UID of MIFARE Classic cards to facilitate attendance registration. I have got it working. However, every time I scan a card on my Galaxy S4, I get a toast stating "NFC tag type not supported".
I want to either block or hide that message while the app is open.
I noticed there was one other question asking for the same thing on a Galaxy S6 but it was down-voted once and then ignored.
I found this conversation on the Samsung Developers forum, however, I could not extract an answer from what is written there:
if (NfcAdapter.ACTION_TECH_DISCOVERED.equals(intent.getAction())) {
myTag = intent.getParcelableExtra(NfcAdapter.EXTRA_TAG);
tagID = intent.getByteArrayExtra(NfcAdapter.EXTRA_ID);
alertDialog.dismiss();
It looks like the alertDialog.dismiss() section is what I need but there is no explanation for where they got the alertDialog object from.
Before Android 4.4
What you are trying to do is simply not possible from an app (at least not on a non-rooted/non-modified device). The message "NFC tag type not supported" is displayed by the Android system (or more specifically the NFC system service) before and instead of dispatching the tag to your app. This means that the NFC system service filters MIFARE Classic tags and never notifies any app about them. Consequently, your app can't detect MIFARE Classic tags or circumvent that popup message.
On a rooted device, you may be able to bypass the message using either
Xposed to modify the behavior of the NFC service, or
the CSC (Consumer Software Customization) feature configuration files on the system partition (see /system/csc/. The NFC system service disables the popup and dispatches MIFARE Classic tags to apps if the CSC feature <CscFeature_NFC_EnableSecurityPromptPopup> is set to any value but "mifareclassic" or "all". For instance, you could use:
<CscFeature_NFC_EnableSecurityPromptPopup>NONE</CscFeature_NFC_EnableSecurityPromptPopup>
You could add this entry to, for instance, the file "/system/csc/others.xml" (within the section <FeatureSet> ... </FeatureSet> that already exists in that file).
Since, you asked for the Galaxy S6 (the question that you linked) as well: I have tested this method on the S4 when it came out. I have not verified if this still works in the latest firmware or on other devices (e.g. the S6).
Since Android 4.4
This is pure guessing, but according to this (link no longer available), it seems that some apps (e.g. NXP TagInfo) are capable of detecting MIFARE Classic tags on affected Samsung devices since Android 4.4. This might mean that foreground apps are capable of bypassing that popup using the reader-mode API (see NfcAdapter.enableReaderMode) possibly in combination with NfcAdapter.FLAG_READER_SKIP_NDEF_CHECK.

Read RFID tag that is already next to the phone before my app started

I wrote a small program that is scaning for RFID Tag, it works fine. But I have a case that I need to read an RFID tag that is already next to my phone before my app started.
Is there a way that can tell Android to scan again for a nearby RFID/NFC tag?
Thanks
No, The Tag is 'Discovered' when it moves into range of the device NFC aerial. You could however utilise the 'Background Dispatch' facility, whereby you define your filters for NFC intents in your Activity definition in your Manifest, as described in the Android documentation for NFC Basics. This way, when you place the Tag near to your device it will read the Tag and start your application at the defined Activity.

unable to run my nfc application

I m creating a sample Nfc application.. in GingerBread2.3.3 - which includes nfc features.. i have checked for the Nfc service running on the system bootup... the service runs perfectly on boot up...
I m using an external hardware to detect the Nfc tags... the hardware is fine... checked it also...
From my application, i have set permission for Nfc and I have included the Nfc feature also..
I found out that NfcAdapter.java - hasSystemFeature() is returning false for Nfc... but my Nfc service is running.... In settings, I don't get any Nfc related features.. On setting this hasSystemFeature() to return true. I get the Nfc settings. But my application does nothing..
I checked in current.xml whether it includes nfc features.. and it also has Nfc features..
Now I m struck not sure what to do.. Pls do help me out with this...

Categories

Resources