yashsingh1/xdaforums huggingface dataset:
[NFC Hacking] ascsa:
Hmmm funny, I already discussed the same issues several times a couple of months ago ;)...

However, sure from an end user perspective, your idea make sense, but keep the facts in mind:

-nfc dispatching is completely done by your firmware

-standard android doesn't support tag lost and was never designed to work this way

-Xposed + the mod change the nfc off behavior and adds a tag lost messages

-screen off means tag lost, because screen off disables nfc while in this " screen off but locked" mode

So if you turn your screen on again after removing the tag, there is no nfc message or whatever to trigger anything... So how should your idea work?

Sure I could imagine some workaround, but this would need some serious hacking, probably would never work reliable and last but not least would negatively affect your overall system performance... So I definitely wouldn't want to go that route.... Especially when I could simply press the power button before removing the tag and achieve the same result...

But I'm always open for suggestions :)

... Sent from mobile...
[NFC Hacking] bso44:
Has anyone experienced their wifi randomly disconnecting at times with this mod?
[NFC Hacking] MohammadAG:
[MENTION=4318422]madfish73[/MENTION]

I modified the source code a bit, there were too many errors being thrown in logcat at bootup. The modified source code should also be a bit faster since it doesn't check if settings need to be reloaded each time the screen is turned on/off. Settings are now reloaded by means of an intent sent from the settings activity. I also moved some constants into Common.java rather than making them public in NFCLockScreenOffEnabler.java.

Here's a patch/diff file:

https://github.com/MohammadAG/NFCLo...f1f027ee3f740730cc0f351857156b92acf771d.patch

May I suggest continuing to use git? Your source code is available here https://github.com/MohammadAG/NFCLockscreenoffEnabler/tree/7edd6569e87610de522b8f8fc36bb09bf99eb2d4 if you want to link to it rather than using a rar file.

Might HOLOfy the settings page next.

Edit: Oh and here's another patch for tag lost sound https://github.com/MohammadAG/NFCLo...74826ab6687c1518f094906486e639337391d3d.patch

It's configurable in settings.

Edit 2: Here's my last patch for a while

https://github.com/MohammadAG/NFCLo...415ffa3529d27ed2b66b2512785571a8291288f.patch

Now adheres to HOLO/Google guidelines:

Before - After
[NFC Hacking] Orphee:
wow, good, any built apk available ? :)
[NFC Hacking] madfish73:
I agree we should use git to maintain this project with the original author qwerty12.

https://github.com/qwerty12/NFCLockscreenoffEnabler/
[NFC Hacking] madfish73:
I've updated the apk modified by MohammadAG in the first post.
[NFC Hacking] Orphee:
Hi !

Thank you !

I tried your code modification some post before, it worked but had same behaviors while screenoff.

My data cable is little tricky so was hard for me to save logcat.

I'm trying new Xposed APK (I restored my original Nfc.apk) and it works great currently !

It seems it solves the screenoff taglost issue :) (older xposed apk had the bug)

Thank you for your work
[NFC Hacking] the_rebel:
Apologies for the very late reply..I kept checking the topic for a day or so but there no updates, and I wasn't getting notifications. (turns out my gmail settings were off, not the forum's fault.. I've hopefully fixed that)

Nevertheless, thank you for your views and insights. Good thing you asked for suggestions as I might have a good one. How about you update a Tasker variable for all the nfc available/not available and which tag is currently available cases? So with this everything else will work like it does right now, but one can also make a profile activating on screen on and performing the task after checking the tag status variable.

How does this sound?
[NFC Hacking] XlAfbk:
Now that a tag lost sound option was added (many thanks for that) would it be possible to add another option to disable tag discovered sound? Would make sense imho.
[NFC Hacking] ascsa:
Sounds good ;) but it's Already implement ... Add a Tasker task advanced (lab) activity... And the custom variable for enabled /disabled status ...

... Sent from mobile...
[NFC Hacking] Orphee:
In fact, it works well only if charging (USB).

with no charging, same behavior... taglost seems to crash...
[NFC Hacking] bso44:
Is it still 1.1? I installed the apk in the OP and the module is still called 1.1.
[NFC Hacking] desirus:
Clear instructions

The OP talks about not having to install mods, but there are two references to mods ( nfc.apk and anytag (mod).

It also seems that the OP was edited a few times to take into account the new use of Xposed., but there are old instructions in the OP to use nfc.apk

I am quite confused, would it be possible to have a cleaned up instruction on using Detecting NFC, I am anxious to use it?
[NFC Hacking] the_rebel:
That's a very useful feature, thank you for pointing that out. I believe only your app has it :) By the way, I like the templates feature too.

Anyway, though I was able to use the NFC tag id in tasker using the vars, but how do I make a profile in Tasker that fires on Display On/Unlocked and it correctly knows if the tag that was there when the display went off is still there or not?
[NFC Hacking] ascsa:
Again good question, a while back, long before the tag lost messages and the Tasker task advanced activity were implemented, an other user did some great Tasker magic to achieve something similar... Have a look/ search within the original retag thread. If I remember it right, he basically used some Timestamp in Tasker and checks after screen on if a tag was fired within a couple of seconds (tag present, when nfc enabling, will automatically fire the tag)... When no tag was fired, he assume that tag lost... Not perfect, but there is simply no "scan tag" or "check if tag present" API, so some workaround is needed.

... Sent from mobile...
[NFC Hacking] the_rebel:
That's interesting! I'll try to find more on this.

In the meantime, maybe you could answer this question for me. When the system is set to detect NFC tag only when display is on, if the phone is lying on an unpowered NFC tag with display on - is the NFC scan happening every few milliseconds or does it know that the tag status hasn't changed and keeps idle?

The reason I'm asking is to have an idea of the effect on battery when my phone is in the car's unpowered NFC tag enabled dock. I still can't stop thinking of the 15-20% per hour battery usage when the phone was on nightstand with nfc.

Thank you
[NFC Hacking] ascsa:
As mentioned, afaik the device powers the tag all the time... I'm not aware of any idle / power save mode within the nfc specification or the Android firmware ... However, keeping screen on is probably much more significant for your power usage than the nfc polling, but that's something you could easily verify for your device by yourself.

... Sent from mobile...
[NFC Hacking] the_rebel:
Yeah I was thinking of doing some testing, but thought maybe I could avoid it by taking the shorter route and ask the expert :)

Thank you for all the patience and help.
[NFC Hacking] w. junior:
After the last update, my NFC stopped working, FC.

I tried uninstalling the module, install the old version and nothing.

What should I do?

Xperia S 6.2.b.1.96
[NFC Hacking] CrazyPeter:
Has this been submited to Google Code as a feature request? Would be nice to get this and not have to root and replace system apps.
[NFC Hacking] Benchow:
I've tried this with my moto x because I cant get the moto skip where I am from.

Theoretically, I shouldnt have to even install anything to have NFC detect when the screen is off because the moto skip already does that.

Anybody have any ideas on how to get this to work with the motoX?
[NFC Hacking] ascsa:
Yep, the motoX should have some "nfc on while screen on, but locked" mode within stock firmware. .. However afaik there is no "tag lost" support...

Hope they didn't mess to much with the firmware so Xposed could still do the magic...

... Sent from mobile...
[NFC Hacking] Benchow:
I can't seem to find this option... either for screen locked or screen off. I'm running stock.

I installed the Xposed framework so I do have the "tag lost" capability. Just not NFC on while screen lock/off.

I ticked it in the settings of the NFC LockScreenOff Enabler.

Still doesn't work with screen off or locked.
[NFC Hacking] mew1033:
Are there any negative consequences for leaving my phone sitting on a tag, say, all night? It'll be plugged in, but I don't want to destroy my battery or melt my phone by leaving NFC polling all the time.

Thanks!

P.S. My idea is to have a "sleeping mode" that activates as soon as I set my (plugged in) phone on my nightstand, and deactivates when I pick it up in the morning.
[NFC Hacking] madfish73:
Maybe I can check it if you upload the NfcSerivce.smali of your MotoX ROM
[NFC Hacking] madfish73:
I've used this "tag lost" mod since 2013.1.

Put my phone on my "bedside tag" every night, on my "CarMode tag" every time I driving.

There's no any noticeable negative consequences.
[NFC Hacking] mew1033:
Do you have it set to scan even when the screen is off? Also, do you have to turn the screen on before you can pick up your phone in the morning?
[NFC Hacking] madfish73:
I've enabled the ScreenOff Nfc feature. Do not need to turn screen on when pick the phone.
[NFC Hacking] Benchow:
I'm not sure where the NfcService.smali is located?

After doing a quick reading, it seems I might need apktool to get it out of my nfc.apk.

I can either upload my nfc.apk or I can get the tool and extract it.

Blah, I think I still need 10 posts to upload something. Let me make a few more comments.
[NFC Hacking] Benchow:
lets see if this works....
[NFC Hacking] madfish73:
also need nfc.odex
[NFC Hacking] Benchow:
it would not let me upload as odex so I renamed it to Nfc.txt, just rename it back to Nfc.odex.

Thanks.
[NFC Hacking] madfish73:
sorry, also need all odex files in /system/framework.

you can pack the folder an upload to a file server and share to me.
[NFC Hacking] Benchow:
OK, done. I sent it to you in a PM since I can't post links yet.
[NFC Hacking] R0g@t:
Help Please,

Have a rooted S3 running stock

Installed Xposed Installer v2.2. Rebooted

Installed NFCLockScreenOffEnabler1.4.apk, Activated module and rebooted

Installed NFC ReTag Pro 2.6. Activated Tag Lost in settings.

Turned on NFC and place phone over tag.

Tag recognised and task set to turn phone to silent

Removed phone from tag.....No option to put in tag lost task ie. turn on sound.

Tried Any Tag Mod.apk. Same result!!!

What am I doing wrong?

Can anybody help?
[NFC Hacking] Benchow:
When you open your Xposed Installer, click modules. You enabled NFC Lockscreen Enabler.

I did not see a step where you then clicked deeper into the NFC Lockscreen enabler settings and checked "Enabled tag lost message". I did not know there were more settings when I first played around with this since it looks just only a checkbox for enable NFC Lockscreen enabler.

I tried disabling "Enabled tag lost message" just to test and it does not pick up tag lost anymore when that is not enabled.

Give that a shot.
[NFC Hacking] ascsa:
Yep, Benchow is right ... and choose an "Enable NFC when" option ... first start seems to have no default option choosen.
[NFC Hacking] R0g@t:
Thanks. I did do that. No joy. Still not working. But thanks for the quick response. Greatly appreciated.
[NFC Hacking] hobbypunk90:
Have the same problem with a Sony Xperia M, nfc tag is detected, but no reaction when it is removed :( any help? option for sending is on and reboot is done :(
[NFC Hacking] Benchow:
Not sure if I can help... but what did you choose when you get to this screen?
[NFC Hacking] R0g@t:
Yes I did. Still didn't work...
[NFC Hacking] ascsa:
Hmm, you mentioned earlier that this is not NFC ReTag related, however please make sure the "Support tag lost!" checkbox is checked and the "Don´t add tag lost tags" checkbox is NOT checked.
[NFC Hacking] R0g@t:
Did that too. Fiddled with ALL the settings permutations. Still didn't work. Maybe something on my phone is stopping it... A kernel setting, an app? Honestly not sure. Going to start from scratch on the weekend. Will report if anything interesting emerges. Thanks for the help though. Very much appreciated.
[NFC Hacking] hobbypunk90:
hello,

settings are all ok ;)

for me it is not retag related, when it would, there have to be a "tag lost sound" or?

greets :)
[NFC Hacking] ascsa:
The tag lost integration with ReTag should be bulletproof if the Xposed and NFCLockScreenOffEnabler module part is working correct. No issues reported so far, but I posted the correct ReTag settings in case someone got confused with the "Support tag lost!" or the "Don´t add tag lost tags" setting.

However, the "tag lost sound" doesn´t work on my testing device, but everything else is working fine. So, I wouldn´t rely on the tag lost sound.

btw. the NFCLockScreenOffEnabler 1.4 has some new (?) debug mode ...so perhaps have a look at the logs .
[NFC Hacking] hobbypunk90:
i tested it, but, i dont know y, but i don't get any nfc related message in log, i read it with aLogcat but there is nothing, but nor sure if my configs are correct :-/
[NFC Hacking] ascsa:
Hmm, not sure what I´ve done, but the tag lost sound is working on my testing device NOW ... probably a simple reboot fixed it :eek: ...

:laugh::laugh::laugh:
[NFC Hacking] R0g@t:
Re-installed Firmware, rooted and started from scratch. Still not working!

I cannot figure out why taglost is not working!
[NFC Hacking] hobbypunk90:
hey,

here i have the logcat entrys, when i remove my xperia from a NFC tag:

10-03 22:46:42.213: W/NFCJNI(1144): Callback: nfc_jni_presencecheck_callback() - status=0x0092[NFCSTATUS_TARGET_LOST]
10-03 22:46:42.213: D/NFCJNI(1144): phLibNfc_RemoteDev_Disconnect(50669b98) returned 0x000d[NFCSTATUS_PENDING]
10-03 22:46:42.213: D/NFCJNI(1144): Callback: nfc_jni_disconnect_callback() - status=0x0000[NFCSTATUS_SUCCESS]
10-03 22:46:42.243: W/System.err(1144):	at pk.qwerty12.nfclockscreenoffenabler.NFCLockScreenOffEnabler$PresenceCheckWatchdogRunHook.afterHookedMethod(NFCLockScreenOffEnabler.java:146)

i hope it can help a little bit? :(
[NFC Hacking] MohammadAG:
Filter for System.err and provide another log, the lines needed in a useful logcat should start with where the Exception is and least 4 lines after that.

Sent from my Samsung Galaxy S4 (i9500)
[NFC Hacking] hobbypunk90:
Hello Mohammad,

i hope this log is better? :)

10-04 18:05:38.017: W/System.err(1143): java.lang.NullPointerException
10-04 18:05:38.017: W/System.err(1143):	at pk.qwerty12.nfclockscreenoffenabler.NFCLockScreenOffEnabler$PresenceCheckWatchdogRunHook.afterHookedMethod(NFCLockScreenOffEnabler.java:146)
10-04 18:05:38.017: W/System.err(1143):	at de.robv.android.xposed.XposedBridge.handleHookedMethod(XposedBridge.java:483)
10-04 18:05:38.017: W/System.err(1143):	at com.android.nfc.nxp.NativeNfcTag$PresenceCheckWatchdog.run(Native Method)

greets,

marcel
[NFC Hacking] MohammadAG:
The log is better, but I can't make out which line the bug's at, are you running the latest APK?

[MENTION=4318422]madfish73[/MENTION] in addition to presence checking, I've added NFC unlocking to the mod for 4.2+ devices, ala Moto X's $20 Skip. The APK is available here, <Link removed, future fork will be available> with the source on my github as usual.

Also, I think the OP needs a rewrite, it's a bit untidy (no centralized changelog, etc).

Explanation on the unlock feature:

The unlocking is done by hooking into the Android keyguard features, when a correct NFC tag is detected, a correct code is simulated and the device is unlocked.

Due to technical limitations in Xposed, I have to use an intent to unlock the device.

The intent is "pk.qwerty12.nfclockscreenoffenabler.UNLOCK_DEVICE"

Leaving the implementation as described above leaves any devices vulnerable to attack, as anyone that knows the APK is installed can use adb shell, or even an app, to bypass the lockscreen.

A day or two of thinking, I decided to overcome this by intercepting the sendBroadcast() method. Any app that decides to use the intent except the Nfc.apk package, will be denied and a notification posted to the user, if you get this notification, then some app tried to use the intent and was caught.

Therefore, this mod is very secure. You may skim over the source code if you have any doubts.

Screenshot for reference:

And here's a failed attempt using adb:

mohammad@mohammad-i5desktop:~$ adb shell am broadcast -a pk.qwerty12.nfclockscreenoffenabler.UNLOCK_DEVICE
Broadcasting: Intent { act=pk.qwerty12.nfclockscreenoffenabler.UNLOCK_ATTEMPT_INTERCEPTED }
Broadcast completed: result=0
[NFC Hacking] hobbypunk90:
I think i have the latest apk :D Version 1.4 - not sure, but can my android 4.1 be the problem? It's sony's Stock rom

Gesendet von meinem C1905 mit Tapatalk 4
[NFC Hacking] MohammadAG:
Could install the latest APK and post a logcat from that?

Sent from my Samsung Galaxy S4 (i9500)
[NFC Hacking] hobbypunk90:
The 1.5 from your last post ? I get File not found :-\

Gesendet von meinem C1905 mit Tapatalk 4
[NFC Hacking] MohammadAG:
Oops, link fixed.

FYI signatures are different so you might need to uninstall the old version first.

Sent from my Samsung Galaxy S4 (i9500)
[NFC Hacking] hobbypunk90:
i have the same problems with 1.5 - but there is no error anymore, the log looks like this:

10-07 20:33:50.862: W/NFCJNI(1084): Callback: nfc_jni_Discovery_notification_callback() - status=0x0036[NFCSTATUS_MULTIPLE_PROTOCOLS]
10-07 20:33:51.262: I/ActivityManager(712): START {flg=0x10008000 cmp=com.android.nfc/.NfcRootActivity (has extras) u=0} from pid 1084
10-07 20:33:51.313: I/ActivityManager(712): START {act=android.nfc.action.NDEF_DISCOVERED dat=vnd.android.nfc://ext/nfc_retag:tag pkg=com.widgapp.NFC_ReTAG_PRO cmp=com.widgapp.NFC_ReTAG_PRO/com.widgapp.NFC_ReTag_dispatch_tag (has extras) u=0} from pid 1084
10-07 20:33:51.363: I/ActivityManager(712): START {cmp=com.widgapp.NFC_ReTAG_PRO/.automode (has extras) u=0} from pid 24156
10-07 20:33:52.003: W/NFCJNI(1084): Callback: nfc_jni_presencecheck_callback() - status=0x0092[NFCSTATUS_TARGET_LOST]

thats the complete log.
[NFC Hacking] R0g@t:
I hope someone can help us out... I did what you did and more. No luck...
[NFC Hacking] ascsa:
Hmm, would like to help, but the ReTag part seems fine (ok, it´s the most easy part, just catching an intent :eek:) and I´m not completely familiar with the xposed and module stuff ....if I find some spare time, I could have a deeper look, but without being able to reproduce your issues and with logs showing almost nothing , I don´t think I could solve the issues, anyway.

However, a lot of people contributed to this mod, and perhaps it would make sense to narrow down your issues a bit ...... My approach would be, to try out one of the first working and stable versions of the mod ...Post #151 should contain such a version .... (try to install this version, enable and reboot !)... this version doesn´t contain any eye candy , tag lost sound etc. but the tag lost message should work ....if this version doesn´t work, there are probably some basic issues with your rom-nfc-xposed-mod :eek: stuff.
[NFC Hacking] madfish73:
It would be help if you could upload more log infos here.

1. upload /data/xposed/debug.log

2. get full logcat log and upload here.

1) run Android Terminal Emulator

2) su

3) logcat -f logfile.txt
[NFC Hacking] hedak:
In debug.txt (had to rename it from debug.log for attaching) just care about lines after '08.10.2013 08:16:22 UTC' as before other modules but NFCLockScreenOffEnabler and Advanced Power Menu have been active.

After phone reboot I let the same NFC tag recognize twice. At first i removed it after one second, the second time i removed it after 5 to 10 seconds.

Many THX for your support :)
[NFC Hacking] hedak:
Well done, ascsa! That did the trick! Did the following:

Disabled NFCLockScreenOffEnabler 1.4 module

Uninstalled NFCLockScreenOffEnabler 1.4

Rebooted phone

Installed NFCLockScreenOffEnabler.apk from post #151 (v1.1)

Enabled NFCLockScreenOffEnabler 1.1

Rebooted phone

Now ReTag recognizes a new tag with suffix 'lost' when removing the tag.

[MENTION=4318422]madfish73[/MENTION]: should be easy to figure out the problem now, right? :)
[NFC Hacking] R0g@t:
It works! Unbelievable! So damn simple! Thank you!

So, the problem is with version 1.4?
[NFC Hacking] madfish73:
yes, thank you for your infos!

I've fixed the problem. It's because of the diffs of android version. The codes of version 4.2 & 4.3 are diffs from v4.1 & before.

I've update the apk in post#1, and the apk version num is still v1.4 :)
[NFC Hacking] hedak:
Need to tell you that i can't install the new 1.4 from first post (downloaded and unpacked rar twice). Using ES File Explorer i get (translated from german) 'Parsing error: Parsing the package failed' :(

I unpacked the old and new package and compared everything (using WinMerge) and only found the dex and hashs to be different. Would you give it one more try please?
[NFC Hacking] madfish73:
I've replaced the rar with apk, please try again.
[NFC Hacking] hedak:
Everythings's working fine now. Thank you so! :o
[NFC Hacking] TeamR:
First of all, i have to say that you've done an incredible work !

I quote you cause i'm on a Sony Xperia Tablet Z (pollux_windy SGP311) under CM10.1.2 (android 4.2.2) and you work is compatible until 4.1.

Any update planified or an other way to run it for me ?

Thanks a lot.
[NFC Hacking] ascsa:
uups, I think the post is a little bit misleading ...should say: "...updated, NOW ALSO compatible with android 4.1 and before...." ....because there was a problem with older android versions ...

I´m running the latest android version without any problems (although xposed not officially support 4.3 ...), so you should be fine with 4.2.2.
[NFC Hacking] madfish73:
sorry for my poor ability of expression :(

It does support 4.1 & before & after...
[NFC Hacking] madfish73:
:good:
[NFC Hacking] drakal:
Nice app, love it!

i'm using it on my Nexus 4, but i wanna now if we can use it on others ROM non-stock? (Can i use it with my HTC One with sense?)

It's compatible with all devices?

Also, i test with "NRC enable when screen off", and my phone is going to deepsleep and NFC work, so my question is: i have huge batterie drain with this configuration or not? Coz my phone going to deepsleep well ! (checked with CPU Spy)

Thx again !
[NFC Hacking] m.klinge:
So I've just installed this on my LG G2 (D802)(Downloaded straight from the xposed installer) - while some features does work others does not.

Confirmed working:

- Tag lost

- Remove sound (Thanks for that btw)

Not working:

- NFC scan on lockscreen

- NFC scan while screen off

- Unlock with NFC tag (Related to the first guess)

Is there anything I can do to help out to get it working? :)

//M
[NFC Hacking] madfish73:
You will have huge battery drain if you keep your phone on a tag, but "Enable NFC when screen off" won't lead to a HUGE battery drain.
[NFC Hacking] madfish73:
1. upload /data/xposed/debug.log

2. get full logcat log and upload here.

1) run Android Terminal Emulator

2) su

3) logcat -f logfile.txt

4) upload logfile.txt
[NFC Hacking] m.klinge:
Uhm havn't got any folder called xposed (And yes it is installed)

The terminal commands doesn't work either - any pointers as to what I'm doing wrong?

//M
[NFC Hacking] ascsa:
Hmm, check if your file manager has some "root explorer" option .... ;)
[NFC Hacking] m.klinge:
I am using a file manager with root explorer - actually its called Root Explorer :P

//M
[NFC Hacking] madfish73:
please check /data/xposed instead of /sdcard/data/xposed or /sdcard/xposed
[NFC Hacking] m.klinge:
I am checking the root/data/xposed, and there's no such folder....

//M
[NFC Hacking] m.klinge:
So I had to go into another data folder - the path being root/data/data/xposed to find it the debug.log - it has been attached. The logcat I still can't do....

//M