yashsingh1/xdaforums huggingface dataset:
[NFC Hacking] miljbee:
Got a D802 a few days ago, and I am very sad to see that I can't enable Nfc while screen Off.

I pulled LgNfc.apk/odex from the phone and backsmali.

I am not familiar with java nor smali, ... but it seems to me that LG as implemented a LNfcService Class derived from NfcService.

If I understand well this xposed module hooks NfcService members, but I'am afraid that here, they are masked by LNfcService members.

Also, I noticed that POLLING_MODE is 0 initialized in NfcService and then updated with 3 in the NfcService Constructor.

In the LNfcService constructor it is updated to 2 or 3 (I haven't been able yet to find why/when).

I can also find calls to mScreenState in LNfcService.

I might be wrong, but I suspect, that if you hook LNfcService Members instead of NfcService Members, It might just work for our G2.

I haven't tried to mod/recompile the apk since I got some errors that I don't know how to fix when decompiling.

Anyway, I hope you will want to help, so I have uploaded all that I think you might need to make it work :

- the framework extracted from the phone

- the LgNfc.pak & odex

- the decompiled files

You can get them here : https://docs.google.com/uc?export=download&id=0B3RTucUBY2bwZDZaLVdUNDVFaE0

Let me know If I can do more.

Regards,
[NFC Hacking] madfish73:
please try the apk in post#1
[NFC Hacking] madfish73:
I will have a look for that
[NFC Hacking] madfish73:
Thank you for your infos. I've updated the apk, please try it View attachment NFCLockScreenOffEnabler.apk.

And because my hard disk failed, I lost all my data. The signature of this apk is different from the one in post#1, you have to uninstall the old one at first.
[NFC Hacking] Anon87:
Xposed installer shows the attachment above as version 1.4 not the latest 1.9.1

Is that correct?
[NFC Hacking] miljbee:
Hello,

Thank you very much for this update. I have tested it quickly and I can say that it works with screen Off. I haven't tested yet the Tag Removal broadcast.

---------- Post added at 01:25 PM ---------- Previous post was at 01:21 PM ----------

It seems that there is a mess between the module in this thread and the one from MohammadAG :

http://xdaforums.com/showthread.php?t=2478163

For what I understand, the one from MohamadAG is based on this one and is also able to unlock your phone with a NFC Tag.

---------- Post added at 01:57 PM ---------- Previous post was at 01:25 PM ----------

I Tested a bit more :

I don't get the TAG Removal Sound.

Also, I have tried to get the TAG_LOST intent from tasker (without modded anyTAG) and I can't get it. But maybe am I doing something wrong in Tasker :

Profile => event => intent Received / action=android.nfc.action.TAG_LOST / Cat=None

Or maybe the intent is directed to anyTag ...

Let me know.

Regards

---------- Post added at 02:20 PM ---------- Previous post was at 01:57 PM ----------

java.lang.NoSuchMethodError: com.android.nfc.VNfcService#checkScreenState()#bestmatch

at de.robv.android.xposed.XposedHelpers.findMethodBestMatch(XposedHelpers.java:241)

at de.robv.android.xposed.XposedHelpers.findMethodBestMatch(XposedHelpers.java:286)

at de.robv.android.xposed.XposedHelpers.callMethod(XposedHelpers.java:890)

at pk.qwerty12.nfclockscreenoffenabler.NFCLockScreenOffEnabler$PresenceCheckWatchdogRunHook.beforeHookedMethod(NFCLockScreenOffEnabler.java:101)

at de.robv.android.xposed.XposedBridge.handleHookedMethod(XposedBridge.java:459)

at com.android.nfc.dhimpl.NativeNfcTag$PresenceCheckWatchdog.run(Native Method)
[NFC Hacking] miljbee:
debug.log from xposed :

View attachment debug.zip
[NFC Hacking] madfish73:
Did a bit hard work base on the ver1.9 code of MohamadAG: View attachment NFCLockScreenOffEnabler19.apk, please try it.
[NFC Hacking] hobbypunk90:
[MENTION=436082]madfish[/MENTION], didn't work on Sony Android 4.1.2 again, your last 1.4 worked, but don't get a taglost when screen off :(

Gesendet von meinem C1905 mit Tapatalk
[NFC Hacking] miljbee:
Thanks. Unfortunately, it seems that NFC removal still not work.

Here is the log when scanning

java.lang.NullPointerException at de.robv.android.xposed.XposedHelpers.callMethod(XposedHelpers.java:890) at pk.qwerty12.nfclockscreenoffenabler.NFCLockScreenOffEnabler$PresenceCheckWatchdogRunHook.beforeHookedMethod(NFCLockScreenOffEnabler.java:124) at de.robv.android.xposed.XposedBridge.handleHookedMethod(XposedBridge.java:459) at com.android.nfc.dhimpl.NativeNfcTag$PresenceCheckWatchdog.run(Native Method)
[NFC Hacking] madfish73:
try again: View attachment NFCLockScreenOffEnabler19.apk
[NFC Hacking] hobbypunk90:
When I click on authorized nfc tags, the app force closes

Gesendet von meinem C1905 mit Tapatalk
[NFC Hacking] madfish73:
I know that, but don't know why. The code is based on MohamadAG's version. It also crashed on my phone when I clicked on authorized nfc tags, but other features go well.

What about the other features on your phone?
[NFC Hacking] hobbypunk90:
No tag lost message :( no new detection with screen locked or screen off...

Gesendet von meinem C1905 mit Tapatalk
[NFC Hacking] madfish73:
Fixed it, tested in N7100 4.1.1 : View attachment NFCLockScreenOffEnabler19.apk
[NFC Hacking] hobbypunk90:
Hey madfish, big thanks, it works :) only the authorized nfc tags still force closes :( on my nexus 7 with cm10.2 it works, with mohamadAGs version

Gesendet von meinem C1905 mit Tapatalk
[NFC Hacking] madfish73:
sorry, try again: View attachment NFCLockScreenOffEnabler19.apk
[NFC Hacking] miljbee:
Scan while screen is off now works. But removal detection still don't :

java.lang.NoSuchMethodError: com.android.nfc.VNfcService#checkScreenState()#bestmatch
at de.robv.android.xposed.XposedHelpers.findMethodBestMatch(XposedHelpers.java:273)
at de.robv.android.xposed.XposedHelpers.findMethodBestMatch(XposedHelpers.java:286)
at de.robv.android.xposed.XposedHelpers.callMethod(XposedHelpers.java:890)
at pk.qwerty12.nfclockscreenoffenabler.NFCLockScreenOffEnabler$PresenceCheckWatchdogRunHook.beforeHookedMethod(NFCLockScreenOffEnabler.java:122)
at de.robv.android.xposed.XposedBridge.handleHookedMethod(XposedBridge.java:459)
at com.android.nfc.dhimpl.NativeNfcTag$PresenceCheckWatchdog.run(Native Method)
[NFC Hacking] madfish73:
tried to fix it, and "authorized nfc tags" should work: View attachment NFCLockScreenOffEnabler19.apk
[NFC Hacking] miljbee:
It seems to work.

Is there a way to get the tag removal intent directly into tasker without the needbto use AnyTag ?
[NFC Hacking] miljbee:
It seems to work (I get the tagLost Sound while screen off), but there is still an error in the log :

Not hooking class NfcService->onCreate
Not hooking class .nxp.NativeNfcTag$PresenceCheckWatchdog
Not hooking class NfcService->onCreate
Not hooking class .nxp.NativeNfcTag$PresenceCheckWatchdog
...
...
...
java.lang.NoSuchMethodError: com.android.nfc.VNfcService#checkScreenState()#bestmatch
at de.robv.android.xposed.XposedHelpers.findMethodBestMatch(XposedHelpers.java:241)
at de.robv.android.xposed.XposedHelpers.findMethodBestMatch(XposedHelpers.java:286)
at de.robv.android.xposed.XposedHelpers.callMethod(XposedHelpers.java:890)
at pk.qwerty12.nfclockscreenoffenabler.NFCLockScreenOffEnabler$PresenceCheckWatchdogRunHook.beforeHookedMethod(NFCLockScreenOffEnabler.java:122)
at de.robv.android.xposed.XposedBridge.handleHookedMethod(XposedBridge.java:459)
at com.android.nfc.dhimpl.NativeNfcTag$PresenceCheckWatchdog.run(Native Method)

Note that I haven't set up the tag to unlock the device.
[NFC Hacking] miljbee:
Ok, after digging a bit into the tasker manual and the source code of your plugin, I understand that for now it won't work.

Would it be possible to update your module so that it Broadcast an intent on tag lost.

The tasker requirements are :

Thanks again for your support
[NFC Hacking] ascsa:
Try NFC ReTag with the Tasker task advanced activity ...should fit your needs ;)
[NFC Hacking] miljbee:
I have just tried : works great !

But I still think that giving the ability to tasker to get the taglost intent would be easier.
[NFC Hacking] ascsa:
Maybe,but from my point of view a broadcast would be a very bad idea ....e.g. having several apps listen to a broadcast wouldn´t allow you to choose a default app (or choose an app case wise) so a lot of things could get messed up ...intents and broadcasts seems to look quite similar, but if you have a look at the details, it´s a completely different handling .....so the right solution would be to let Tasker catch the intent, not changing the intent to a broadcast only because Tasker isn´t able to handle the intent ...
[NFC Hacking] miljbee:
I agree with you, that's why I haven't asked to replace the existing intent. But I admit it wasn't clearly stated.

Of course the existing intent should stay at least because it is already used by other third party apps, but also because it's a proper way to implement the need.

But reguarding tasker, there is no way to let it know about the tag lost event other than using an intermediate app. Sure, that's not a big deal, but considering how easy it seems to be to broadcast an additionnal intent, I thought it would be great.

Also, broadcasting an intent when a tag is identified would allow tasker to completely handle by itself NFC automations.

There are some other ways to trigger tasker tasks, which would address the broadcast issues, but they might not be as easy to implement.
[NFC Hacking] madfish73:
Great idea, you can try it:

View attachment NFCLockScreenOffEnabler19.apk

View attachment NFCLockScreenOffEnabler1.9-src.zip

when tag discovered, broadcast intent(no space in string): pk.qwerty12.nfclockscreenoffenabler.TAG_DISCOVERED_XXXXXXXX

when tag lost, broadcast intent(no space in string): pk.qwerty12.nfclockscreenoffenabler.TAG_LOST_XXXXXXXX

where XXXXXXX = tag id (HEX) , like(no space in string): pk.qwerty12.nfclockscreenoffenabler.TAG_DISCOVERED_CD6D81F4
[NFC Hacking] miljbee:
I haven't been able to receive the broadcast.

I found this in logCat :

10-24 13:44:26.952 W/ContextImpl(789): Calling a method in the system process without a qualified user: android.app.ContextImpl.sendBroadcast:1135 de.robv.android.xposed.XposedBridge.invokeOriginalMethodNative:-2 de.robv.android.xposed.XposedBridge.invokeOriginalMethod:651 de.robv.android.xposed.XposedBridge.handleHookedMethod:482 android.app.ContextImpl.sendBroadcast:-2
[NFC Hacking] madfish73:
Weird...it works good for me, Galaxy Nexus 4.3. Maybe the problem is caused by the "Multi User Mode“ of 4.2 ?
[NFC Hacking] miljbee:
Sorry, I messed up when defining the intent in tasker.

Once properly set up, it works fine.

However, I have a last request !

instead of broadcasting pk.qwerty12.nfclockscreenoffenabler.TAG_DISCOVERED _XXXXXXXX and pk.qwerty12.nfclockscreenoffenabler.TAG_LOST _XXXXXXXX, you could broadcast pk.qwerty12.nfclockscreenoffenabler.TAG_DISCOVERED_LOST with the other info as extras.

for exemple : 'state'='discovered', 'uid'='uid hex'

That would allow easier set up in tasker. (it seems that tasker exposes intent extras in local variables)

Here is how I see the tasker part :

Profile NFC_TAG_EVENT:

Context : Intent Received, Action = pk.qwerty12.nfclockscreenoffenabler.TAG_DISCOVERED_LOST

Task : SetCurrentNfcTag

Task SetCurrentNfcTag:

Variable Set : %NFCTAGID <= %uid if %state matches discovered

Variable Set : %NFCTAGID <= none if %state matches lost

By doing this, We can now set up additionnal profiles with context based on %NFCTAGID Value

Further more, with this method there is no need to dig the logs to find the NFCTag uid. it's available directly in tasker.
[NFC Hacking] madfish73:
I tried it, but the matches condition didn't work. Can you give the docs about "tasker exposes intent extras in local variables", I want the details.
[NFC Hacking] madfish73:
it works now, try it: View attachment NFCLockScreenOffEnabler19.apk

Action = pk.qwerty12.nfclockscreenoffenabler.TAG_EVENT

extra variables: %uid, %state
[NFC Hacking] miljbee:
Great work. For me it's perfect !

About the LG G2 Support. You could update your first post to specify that it supports the LG G2 (D802 - internationnal version).

There is several different G2 models, and I read somewhere that it doesn't work on some other variants.

Thank you very much for your help and support.
[NFC Hacking] homer70:
Does this work for a Razr i xt890

HI All,

I have a rooted Razr XT890. Should this work?

I've installed xposed and NFC lockscreenoff enabler v1.9.4 but can't get it working. I have rebooted my phone as required. Is there any way I can prove it out? I have catlog installed - what should I see if the tag is discovered and lost?

Thanks

Homer
[NFC Hacking] madfish73:
what's your android version?

and please try the version in post#1

I've tested it on Galaxy Nexus 4.3 and Galaxy N7100 4.1.1, and miljbee have tested it on LG G2 D802, it works.
[NFC Hacking] MohammadAG:
[MENTION=4318422]madfish73[/MENTION]

I received your PM, but I haven't looked at the code yet.

I implemented what you mentioned it does in my code, with standardized names.

You're free to merge your code with that.

Please, if you want to send patches, use Github. 3 different people are contributing / have contributed to the project, using rars as a way to release sources is very bad. It makes the work tedious for whoever wants to merge the changes.

In any case, here's my implementation.

The same intent used to start the activity is now also sent as a broadcast (android.nfc.action.TAG_LOST)

Another intent (android.nfc.action.TAG_CHANGED) is also sent when a tag is detected or lost.

The two intents have an extra with the key tag_uuid, this can be accessed using %tag_uuid (as per here)

The second intent also has the boolean extra tag_present, which is true when a tag is detected, and false when it's lost.
[NFC Hacking] XlAfbk:
edit: nvm
[NFC Hacking] XlAfbk:
due to the recent addition of intent broadcasts I uninstalled NFC task launcher and no have no app at all handling NFC, just Tasker receiving the intents. Thing is, now the NFC start + complete sounds are gone. Instead on scanning a tag I get only the error sound. (the removal sound works perfectly fine). Is there any chance to fix this in the mod?
[NFC Hacking] CarpeNoctem:
I installed the module in Xposed and tried to use tasker as explained using "pk.qwerty12.nfclockscreenoffenabler.TAG_LOST_XXXXXXXX"

In my case, it became pk.qwerty12.nfclockscreenoffenabler.TAG_LOST_048B5D42402B80

I created a simple task displaying a popup if successful but... no popup.

Any help ?
[NFC Hacking] XlAfbk:
If you got the one from the repo then these instructions are for you:

The same intent used to start the activity is now also sent as a broadcast (android.nfc.action.TAG_LOST)

Another intent (android.nfc.action.TAG_CHANGED) is also sent when a tag is detected or lost.

The two intents have an extra with the key tag_uuid, this can be accessed using %tag_uuid (as per here)

The second intent also has the boolean extra tag_present, which is true when a tag is detected, and false when it's lost.
[NFC Hacking] CarpeNoctem:
Thank you!!
[NFC Hacking] abuttino:
I am quite experienced with tasker but have absolutely no idea how to program Intents..

This:

If you got the one from the repo then these instructions are for you:

The same intent used to start the activity is now also sent as a broadcast (android.nfc.action.TAG_LOST)

Another intent (android.nfc.action.TAG_CHANGED) is also sent when a tag is detected or lost.

The two intents have an extra with the key tag_uuid, this can be accessed using %tag_uuid (as per here)

The second intent also has the boolean extra tag_present, which is true when a tag is detected, and false when it's lost.

Doesn't make any sense to me.

What I am reading here is that the instructions in the beginning of this thread are invalid and Action as the "Intent received" is now "android.nfc.action.TAG_LOST" or "android.nfc.action.TAG_DISCOVERED"

???????

Can someone please export a Tasker profile as a description so we can all understand this?
[NFC Hacking] XlAfbk:
The instructions on the first post are correct for the apk posted in this thread. The apk in Xposed repo is a different one and uses different intents.

How to set up Tasker is described in http://xdaforums.com/showpost.php?p=46769201&postcount=341
[NFC Hacking] abuttino:
Thanks, that was my entire morning (cussing and yelling)..

<sarcasm>Not to make Intents even more difficult for non-programmers</sarcasm> then, why was this changed in the fork build?

Or better yet, why does the fork build have more exposure than this original build in the xposed repo.
[NFC Hacking] MohammadAG:
I decided to use standard naming conventions. The one in the repo is the fork, I asked qwerty12 for permission to maintain that updated version on the repo as it has better version control and contains NFC Unlocking.
[NFC Hacking] abuttino:
Thanks for the answer but I don't think this is logical.
[NFC Hacking] CarpeNoctem:
I have to say I found this way of capturing the event way more logical. I implemented it really easily and it allows me to launch my GPS, activate a few thing and put the device in extended desktop mode when I step in my car and put everything back to normal when I step out.

Really a nice piece of work

I need now an extension that hide the status bar with the same kind of functionality, one I found is good but not as good
[NFC Hacking] abuttino:
You have to use at least 3 tasks to complete the same thing one task could do. Plus, I was complaining about the fact there is no continuity between the two versions
[NFC Hacking] XlAfbk:
1. Nothing stops you from using it the "old way"

2. It's actually the same number of tasks. 1 general NFC-handler profile (which replaces your NFC app) and the profiles just check for a variable (%NFCTAGID here) to be set/unset.
[NFC Hacking] drakal:
There is a way to make it work with a Nexus 5 and Android 4.4?

Thx
[NFC Hacking] robz2k:
yes please :)
[NFC Hacking] ascsa:
xposed isn´t compatible with Android 4.4, yet .... there was a donation request to buy rovo89 (xposed dev) a nexus 5 and afaik the device is already ordered ....so you have basically 2 options: -just wait for the xposed update or do it the old school way and mod your nfc.apk ...
[NFC Hacking] drakal:
This module don't work with Xposed for KitKat, i'm on a Nexus 5.

Is dit possible tout add support fort this phone ? If not, how to enable manualy by edit thé nfc apk plz? What changes i have to do ?
[NFC Hacking] ascsa:
xposed beta for kitkat was released yesterday, the mod (direct from the xposed repository) is working without problems on my nexus 7 (2012) 4.4 testing device ...that´s my primary testing device for the xposed stuff and I don´t want to install the mod on other devices, so can´t reproduce your issues ... anybody else with issues on the nexus 5?
[NFC Hacking] drakal:
Argh, i use an NFC tag to unlock my phone ans i don't know how tout do this without this module :(
[NFC Hacking] ascsa:
Hmm OK ...I use the module only for the Tag lost message (and this is working fine!), but I can confirm that the unlock feature isn´t working on the nexus 7, too ....so you´re right , module isn´t fully compatible with KitKat Xposed ... aargh ;)
[NFC Hacking] drakal:
Hi,

Last version of this module recognize NFC when screen off well, but the unlock feature still not work with kitkat ;)
[NFC Hacking] ascsa:
hmm tried the latest 1.9.7.1 version on kitkat a couple of minutes ago and the unlock feature seems to work .... ;)
[NFC Hacking] Knievel_Spirit:
I'm getting a bit lost in this thread.

Can anybody re post the steps 1 by 1? I'm a rooted GS4 t-mobile variant, xposed installed with the NFC module installed. After that I need a little assistance :confused:

I'm on stock as well and have Secure Settings Pro and the Helper installed. Specifically the Tasker part I'm confused about. Any help?
[NFC Hacking] naboleo:
I'm a bit stucked here too.

First ID TAG is longer than the op, and rather looks like AABBCCDDEEFFGG. It can be easily found when adding the tag in "autorized" list

Applying tag on my phone, enable screen when locked ... I guessed it's the general purpose/behavior and module is correctly installed

But intents doesn't seem to work : "discovered" and "lost" ones doesn't launch the basic tasks created (toast notification only for debug)

I didn't match any revelent information within logcat, even so I enabled the debug option.

Checked the intent spellcheck... I may be blind.

Anyone got a working tasker export I can adapt ?
[NFC Hacking] XlAfbk:
you're probably using the wrong intents, see http://xdaforums.com/showpost.php?p=47213074&postcount=351
[NFC Hacking] naboleo:
Thanks !

It also means it's even simplier and I only need one profile now by using TAG_CHANGED intent & boolean

Maybe an op can stick this information within first post ...

EDIT : Here is my sample. Working fine

EDIT2 : Attempt for download fix

http://www.multiupload.nl/L513HHN2Q4
[NFC Hacking] Knievel_Spirit:
I can't open the zip (error downloading from site). I'm still confused with the itent..Besides that I have everything correctly functioning...

If I was to type it into tasker, how would it look? and after I create the profile, what task do I create? Lets so I want to put it on a tag to start bluetooth, and run pandora..Then when I remove it from the tag, it turns off bluetooth and exits pandora.

How would that look?
[NFC Hacking] naboleo:
Tasker is kind on sequential programing so profile is related to "detect" tag. But it's generic, so you have to specify the tag ID as a condition for only launching your task (the list you mentionned) when correct tag is detected.

Look at the sample (edited) it's very basic.
[NFC Hacking] Knievel_Spirit:
Got it imported. Giving it a test and will post back after a bit of coffee. Thanks for the help! I'll let you know how it works:good:

---------- Post added at 09:40 AM ---------- Previous post was at 09:09 AM ----------

Still having trouble figuring out how to get the bluetooth and pandora turned on... Imported the profile and tried to study it but still at a lost
[NFC Hacking] Knievel_Spirit:
Here's the items I'm looking at and settings I have written. Still not getting anything to pop up even with the profile provided. Any idea?
[NFC Hacking] naboleo:
Something is getting wrong with attachement as I can't read your screenshot. Anyway it's seems to me that you are really new to tasker. Why not just start with a simplier tool :

https://play.google.com/store/apps/details?id=com.jwsoft.nfcactionlauncher

That would probably help to get your automation complete quickly
[NFC Hacking] Knievel_Spirit:
I already have that installed actually but I was trying to shy away from it.

This seems very simple but I'm just missing something..I am using the module from the xposed repository as opposed to the one provided in the 1st post...(if that helps any..).

EDIT:Got it working, thanks for sending that profile! Helped me get a hang of things
[NFC Hacking] electriczbif:
Hi,

I'm using Nexus 5 / Android 4.4.2 / Xposed / NFC LockScreenOff Enabler 1.9.7.2 / Tasker

I have succesfully set up Tasker to launch different tasks on android.nfc.action.TAG_CHANGED intent, but I have the following issue:

Every time I scan a tag I get a screen with "New tag collected" or, if I have another NFC app installed, a "Choose an action" dialog.

The only way to avoid this I have found is to install Locale NFC Plugin for Tasker and to write the URI "bad://access/development" in the tag.

Is there another way to ignore the tags and let tasker to do it's stuff, without the need to install another NFC app/plugin?

Thanks,
[NFC Hacking] XlAfbk:
http://repo.xposed.info/module/com.mohammadag.disablenfctagempty
[NFC Hacking] mulderfbi:
You can use "App Disabler" to disable "Tags" (com.android.apps.tag) I had the same annoying pop-up :) with my N4_4.4.2