yashsingh1/xdaforums huggingface dataset:
[Nexus 4 Android Development] aznxk3vi17:
Reporting back with some preliminary battery life information: it's not looking too hot.

I've drained 35% in 3 hours. I have done absolutely nothing to the phone but let it sit. I'm going to have to revert back; this is too much drain for just a tiny bit of convenience.
[Nexus 4 Android Development] steslatt:
For me NFC does not work while the phone is in deep sleep and I don't appear to be having serious battery drain. I am happy with the mod, it is exactly what I wanted, now I don't have to unlock the phone, just wake the device with power button then it works :)
[Nexus 4 Android Development] 3Shirts:
Any chance of a version that works as normal but is silent. That's all I need
[Nexus 4 Android Development] brium13:
sorry, I made a typo, the name is classes.dex ...

I repeated the manipulations but it still does not ...
[Nexus 4 Android Development] brium13:
It's okay, I managed, good good goog, thank :good:

I share my file. "Should be put in the first post"

NfcNci.apk for CyanogenMod 10.1
[Nexus 4 Android Development] brium13:
I want this as well : Rire:
[Nexus 4 Android Development] KidCarter93:
I've just added this mod to the Nexus 4 Complete Index :)
[Nexus 4 Android Development] steslatt:
I've drained 8% over 2 hours. Thats with wifi on but not connected and gps on.
[Nexus 4 Android Development] Stryder5:
So there's no abnormal drainage with this mod then?
[Nexus 4 Android Development] steslatt:
I need to do more testing to know for sure but it appears not no.
[Nexus 4 Android Development] aznxk3vi17:
Have you left it sitting on an NFC tag? I have a tag under my desk for my home tag (Wi-Fi on, Bluetooth off, sound on, etc.). It's right next to my mouse pad and is where my phone sits by default.

Perhaps it was just an anomaly. I can give it another shot.
[Nexus 4 Android Development] steslatt:
No i just swipe the phone over the tag to activate/deactivate whatever I need.
[Nexus 4 Android Development] steslatt:
Ok after more testing here are my results for similar usage.

With modified NFC - 2 hours drained by 8% hardly any usage, screen on a few times. 7 hours drained by 50% light to moderate usage.

With Stock NFC - 2 hours drained by 3% hardly any usage, screen on a few times. 7 hours drained by 27% light to moderate usage.

The modified app does seem to drain substantially more battery. I would like to see the results with a modified app that doesn't poll with screen off but does poll when screen is switched on without being unlocked.
[Nexus 4 Android Development] Stryder5:
Thanks for the report. I'll wait to see if there's a modified app where it only polls with screen on without being unlocked.
[Nexus 4 Android Development] CptanPanic:
Thanks for the testing. I will make one that works with just the screen on but locked .
[Nexus 4 Android Development] CptanPanic:
Attached is a version tthat has the Nfc Polling on if the screen is on.
[Nexus 4 Android Development] aznxk3vi17:
Will return to testing right away. Thanks - this should be ideal.
[Nexus 4 Android Development] brium13:
Hello, is it possible to make a mod so that the sound is turned off?

Thank you in advance.
[Nexus 4 Android Development] steslatt:
Thats great thanks. I will test today/tomorrow to see if there are any effects on battery life.

Don't suppose you could tell us how you modified that app could you?
[Nexus 4 Android Development] 3Shirts:
I'll keep saying it in the hopes it annoys someone into action :)

Silent version?
[Nexus 4 Android Development] CptanPanic:
Yeah code change was the easy part, I just changed the value of POLLING_MODE variable in NfcService.java. Hard part was learning how to build and install it.
[Nexus 4 Android Development] steslatt:
I did try that myself but I must have done something wrong because it didn't work :/

Did you change the value to 2 from 3?

I don't have any programming knowledge but I can deodex, decompile and re-compile etc.
[Nexus 4 Android Development] brium13:
: Good:
[Nexus 4 Android Development] CptanPanic:
I am not sure of the value I used as I used the enum SCREEN_ON_LOCKED since I didn't use decompile but built from source.
[Nexus 4 Android Development] Xentar712:
Hmmm, I just lost the ability to turn NFC on and off all together. I even tried reverting back to the old one and rebooting. Permissions were applied through adb. Wonder where I went wrong.
[Nexus 4 Android Development] steslatt:
After some testing battery seems a lot better when compared to the screen off version. I'd say its very similar to the original app. Thanks again for the mod.

Try doing it using a file explorer instead. That was my method and it works fine for me.
[Nexus 4 Android Development] Xentar712:
I did. I must have broken something beyond the apk itself. I'm sure the apk is fine but the system settings are just not recognizing it. In settings, I can no longer see options for NFC or Android beam. I've tried dirty flashing my rom, removing the apk and reflashing my rom, wiping caches. The only thing I know restores it for sure is a factory reset. It's going to be a little trial and error before I figure it out. If not, I'll just wait for my next rom upgrade and just do a clean install.
[Nexus 4 Android Development] 0.0:
Did you fix permissions?

Sent from my Nexus 4
[Nexus 4 Android Development] Xentar712:
Yes, in TWRP and manually. Fix permissions seemed awfully quick in twrp though(under 1 sec). Is that normal? Haven't used that option in a year
[Nexus 4 Android Development] nawoa:
8% in 2 hours sounds pretty high to me. Granted, I don't have a ton running on my phone but I think about 1% per hour is roughly what I get.
[Nexus 4 Android Development] Stryder5:
That was before the new update.
[Nexus 4 Android Development] steslatt:
Yes this was the old app. The new one has much better battery life, equal to stock i'd say.
[Nexus 4 Android Development] kgdg:
Does'nt messing around with the Nfc.apk cause Google Wallet to break permanently -> Getting the 'Secure Element Missing' error?
[Nexus 4 Android Development] steslatt:
I thought it was swapping roms that does that? If you don't reset the wallet app each time you flash a new rom? Not an issue for me as I can't use wallet in the UK. Some people also say its a myth anyway and is caused by something else.
[Nexus 4 Android Development] greezestain:
Quick bump. Is it confirmed that this doesn't break Google Wallet? Has someone actually checked this?
[Nexus 4 Android Development] CptanPanic:
Google wallet works fine for me.
[Nexus 4 Android Development] ErzlordCaron:
Unfortunately, this did not have any effect for me. I doublechecked that the downloaded apk is in /system/app (via size and checksum), I checked the permissions and I rebooted my device.

However, no tag is recognized with screen off or in lockscreen.

I used the apk linked in the first post.

Any ideas?
[Nexus 4 Android Development] Stryder5:
Are the tags recognized with the screen on and unlocked?
[Nexus 4 Android Development] Stryder5:
Did anyone get this working on Paranoid Android? My device now doesn't have an NFC option and my NFC apps says this device doesn't support NFC.
[Nexus 4 Android Development] Xentar712:
I never got it to work. Last time I tried I got the same problem as you. Only solution was for me to do a nandroid restore
[Nexus 4 Android Development] ErzlordCaron:
Yes, I still have the APK from here installed and am happily using NFC.
[Nexus 4 Android Development] Stryder5:
Can someone please tell me how you installed it? I renamed the original NFC apk using Recovery then copied over the modified file and it didn't work.
[Nexus 4 Android Development] J000rg:
The One with Only work on screen on doesnt work on cm 10.1, can someone upload a Nfc.apk which works only on screen on, but locked and on CM 10.1 ?
[Nexus 4 Android Development] J000rg:
Nevermind, did it myself:
[Nexus 4 Android Development] yogeshmha:
doesnt work on screen off :(
[Nexus 4 Android Development] Stryder5:
There was a version with it but it drained the battery.
[Nexus 4 Android Development] Anon87:
Any chance development on this mod will be continued? Doesn't seem to work atm. :confused:
[Nexus 4 Android Development] yogeshmha:
At least should have kept that screen off file for testing
[Nexus 4 Android Development] thE_29:
Didnt work for me with current nightly 10.1..

NFC service will end always :(

How did you manage to do it by yourself?
[Nexus 4 Android Development] Stryder5:
This worked perfectly for me on Paranoid Android. Thank you so much!!!! Thanked your post! :good::good: :victory:
[Nexus 4 Android Development] ErzlordCaron:
To what grade are these ROM specific? Can I use the last one posted on stock?
[Nexus 4 Android Development] Stryder5:
The stock one should be for stock-based ROMs. The CM one should be used for CM. Turns out that the CM one works for PA as well.
[Nexus 4 Android Development] thE_29:
Did it work out of the box, or did you have to restart the device?

The "CM one" doesnt work with my CM 10.1 latest nightly... (and i have a non-wallet version, or at least i have no wallet function in europe)
[Nexus 4 Android Development] Stryder5:
I rebooted to be safe.
[Nexus 4 Android Development] thE_29:
The solution was sooo simple: After reboot everything works :D
[Nexus 4 Android Development] amlior:
what should i do with the original odex file after backup? delete it? or leave it there with the new NfcNci.apk?
[Nexus 4 Android Development] Stryder5:
Keep it somewhere safe in case you need to restore it.
[Nexus 4 Android Development] umber:
CM10.1 update.zip

here a update.zip from this Version, the update.zip renamed the original NfcNci.apk to NfcNci.apk.old.

http://xdaforums.com/showpost.php?p=36183507&postcount=53
[Nexus 4 Android Development] Stryder5:
Awesome, I'll test it out tonight. This'll save me time from figuring out how to make the zip myself haha. Thanks!
[Nexus 4 Android Development] Stryder5:
This works perfectly with Paranoid Android. Just tested it out. Flashed fine. Detects the NFC tag with screen on, but locked.
[Nexus 4 Android Development] lopez1_de:
Hi, you should edit the first post of this thread and attach both versions (stock/CM10.1) into this post and write down the install instructions. Everything else is to much confusing. :)

PS: The Cm10.1 version for "screen must be on" works great! Be sure you MOVE the old apk and don't just rename it like I did!
[Nexus 4 Android Development] :
Any way to get a version that doesn't work when the screen is off, but on and still locked? Having nfc on while screen off seems like a waste of battery to me. Thanks
[Nexus 4 Android Development] Stryder5:
If you'll read through the thread, the only versions up should do exactly as you described.
[Nexus 4 Android Development] :
True!

Question though: The last version posted by umber... is it turning on nfc on Screen off or on screen on and locked?
[Nexus 4 Android Development] Stryder5:
NFC works with screen on, but still locked.
[Nexus 4 Android Development] Kazliux:
Hello,

After installing modified apk, file - every boot I am getting: Android is upgrading, starting apps message...

Reverted back to the orginal one - issue is gone. Any thoughts?
[Nexus 4 Android Development] :
AW: [MOD] Modified NfcNci.apk to poll while screen is off.

...
[Nexus 4 Android Development] Stryder5:
What ROM are you on and what version did you install? How did you install it? Also, try clearing cache/dalvik.

???
[Nexus 4 Android Development] Kazliux:
i do use stock rom and franco kernel. Installed the last one version. Didn't wiped cache.
[Nexus 4 Android Development] Stryder5:
Was it an APK or a ZIP? Was it for stock or CM?
[Nexus 4 Android Development] truthlesshero:
this is kind of a confusing thread...hehe

so which one should i get if i want to poll just when the screen is on (locked) and on aokp?

i'm assuming it doesn't affect the battery since it only kicks in when the screen is on anyway?
[Nexus 4 Android Development] Chill0utb0y:
AW: [MOD] Modified NfcNci.apk to poll while screen is off.

Take the flashable zip-file from page 7. it works for all cm-based ROMs.
[Nexus 4 Android Development] :
AW: [MOD] Modified NfcNci.apk to poll while screen is off.

Can nfc still be user controlled or not? If i flash the "on when screen off" zip and have tasker deactivate nfc on screen off, will it be on or off?
[Nexus 4 Android Development] Stryder5:
If you turn off NFC, then NFC will be disabled, regardless of what version you are using.
[Nexus 4 Android Development] :
AW: [MOD] Modified NfcNci.apk to poll while screen is off.

Thanks. Is the zip in post nr. 14 supposed to be flashed in recovery or should i extract it?
[Nexus 4 Android Development] Stryder5:
If it's a zip, it probably should be flashed. Remember to always backup before trying something new!
[Nexus 4 Android Development] :
AW: [MOD] Modified NfcNci.apk to poll while screen is off.

Then why do i get an error trying to flash it?
[Nexus 4 Android Development] Stryder5:
What ROM are you on? What did you flash? What's the error? If you are going to ask for help, attached least provide more information.
[Nexus 4 Android Development] :
AW: [MOD] Modified NfcNci.apk to poll while screen is off.

I'm on pa. Twrp just says error without further info. I just need a version that stays on when the screen is off and that i can flash in recovery. I've had nothing but problems when exchanging any apk.
[Nexus 4 Android Development] Chill0utb0y:
AW: [MOD] Modified NfcNci.apk to poll while screen is off.

There is no version which works when screen is off and works on pa (due to battery life). There is a version which works on pa when screen is locked. you can find the flashable zip-file in page 6.
[Nexus 4 Android Development] Stryder5:
Uncheck the box that says zip verification in TWRP before flashing.
[Nexus 4 Android Development] Stryder5:
Learn to read or search. It isn't the OP's responsibility to spoon feed information. I'm just grateful that the OP made the mod at all and am glad someone turned it into a flashable zip.
[Nexus 4 Android Development] AutruiP:
Hi :) Very nice app, but i would like to know if i need to deodex my rom to using it ? Thanks !
[Nexus 4 Android Development] jazzboyrules:
Thanks, the apk from your post ( http://xdaforums.com/showpost.php?p=36183507&postcount=53 ) worked perfectly for me. It allows NFC polling only with screen on (locked screen included). I am running the Feb 14 version of Paranoid Android (Android 4.2.2).
[Nexus 4 Android Development] :
AW: [MOD] Modified NfcNci.apk to poll while screen is off.

Any chance somebody can modify the new app from 4.2.2 to work with cm10.1 on screen off?
[Nexus 4 Android Development] Stryder5:
Why would you want it to work during screen off? It'll drain your battery.
[Nexus 4 Android Development] :
AW: [MOD] Modified NfcNci.apk to poll while screen is off.

I turn it off when my screen is off and back on when the screen is on, it activates faster than the version that only works with locked screen ;)
[Nexus 4 Android Development] Stryder5:
I don't get it. So if you turn NFC off when the screen is off, what's the point of asking for a version that keeps NFC working with the screen off. Or how that would be faster than having a version that always works with screen on.
[Nexus 4 Android Development] :
AW: [MOD] Modified NfcNci.apk to poll while screen is off.

Okay, I'll try to explain. I use tasker to do this. Screen off -> nfc off. Screen on -> nfc on.

If i have the screen off app i can immediately turn it on when i turn the screen on.

If i have the screen on apk the phone tells the app "you could turn on now if you wanted to" before tasker is able to start nfc directly. And the apk checking if the screen is actually on before being activated by tasker takes time. More time than it would with the other apk, i tested it.
[Nexus 4 Android Development] Stryder5:
Installing the modded NFC apk will already take care of this. There's no reason to set Tasker up to do so.

For example, I turn my screen on (still locked), NFC turns on and can detect my NFC tag immediately. I turn the screen off and it stops detecting my NFC tag. There's no delay other than the time it takes to turn on/off the screen. So I still don't understand what you are trying to accomplish with Tasker :confused:
[Nexus 4 Android Development] :
AW: [MOD] Modified NfcNci.apk to poll while screen is off.

Well in that case my approach really is pointless. But pointless or not, an updated modified apk would stiol be nice.
[Nexus 4 Android Development] jamiegt10:
Good Morning

I upgraded my nexus 4 yesterday to 4.2.2 stock i then attempted to replace my NFnci.apk with the one to allow use with lock screen, Now i cant get NFC to work at all! the option to enable it under settings/wireless & Networks/ More has gone!?!

anyone any idea what i have done and how i can get it back?

thanks
[Nexus 4 Android Development] CptanPanic:
You will have to wait for a 4.2.2 version, as the old one won't work. Hopefully you backed up the apk
[Nexus 4 Android Development] jamiegt10:
alas no :rolleyes:

the 4.2.1 version was backed up and must not overwrite.

i have managed to export the 4.2.2 files from the google factory image but that sill has not given me back NFC
[Nexus 4 Android Development] Stryder5:
Check permissions on the APK. It should be 644.
[Nexus 4 Android Development] jamiegt10:
thanks for the quick reply

i have looked and both of the nfcnpi files are 644 (rw-r--r--) with both owners.

I can wait for the 4.2.2 version to come out and see if that gets it back
[Nexus 4 Android Development] thE_29:
Did you make a reboot after replacing the file? I must always make a reboot, in order to get it working..
[Nexus 4 Android Development] :
AW: [MOD] Modified NfcNci.apk to poll while screen is off.

So can somebody please make an aosp version for 4.2.2? Thanks
[Nexus 4 Android Development] odeccacccp:
That being 4.2.2 can we please have a version screen on but locked. Thank you.
[Nexus 4 Android Development] shogunmark:
Hey guys, does anyone have their stock nfcnci.apk from 4.2.1 laying around? I need the original file back as I seemed to have accidentally deleted my backup. Thanks
[Nexus 4 Android Development] Stryder5:
I'm using the CM based version someone posted earlier in the thread for 4.2.1. I'm now on a 4.2.2 ROM (Paranoid Android) and it still seems to work fine :confused:
[Nexus 4 Android Development] CptanPanic:
I have updated the OP with a new version that works in stock 4.2.2
[Nexus 4 Android Development] R0N1N:
Is that odexed or deodexed? I am running deodexed stock 422

Thanks
[Nexus 4 Android Development] :
AW: [MOD] Modified NfcNci.apk to poll while screen is off.

I'm a bit confused. What exactly is "stock" here? I thought since this is a nexus stock should be = aosp so why wouldn't the apk work everywhere?
[Nexus 4 Android Development] CptanPanic:
It may, but I only run stock ROM so I can't test.
[Nexus 4 Android Development] CptanPanic:
I run just regular odexed stock ROM.
[Nexus 4 Android Development] AutruiP:
Soit with a deodexed rom it will not work ?
[Nexus 4 Android Development] R0N1N:
Just tested it works with deodexed stock
[Nexus 4 Android Development] AutruiP:
Great, thanks for the feedback !
[Nexus 4 Android Development] :
AW: [MOD] Modified NfcNci.apk to poll while screen is off.

Okay, so I just found out there is in fact no difference between stock and not stock. Should be working on every rom out there.

Is this version for screen off or locked?
[Nexus 4 Android Development] pkadavid:
For 4.2.2, do I still need to set the permissions, or just flash the zip?
[Nexus 4 Android Development] CptanPanic:
Locked
[Nexus 4 Android Development] :
AW: [MOD] Modified NfcNci.apk to poll while screen is off.

Looks like i have to revert my statement. I've had issues with it recently. So we still need a cm10 version. Would be great if somebody could make one.
[Nexus 4 Android Development] Stryder5:
Did you try this version yet?

http://xdaforums.com/showpost.php?p=36183507&postcount=53

Or this?

http://xdaforums.com/showpost.php?p=36495895&postcount=67

I'm using it with Paranoid Android (4.2.2 build) and it works fine. Read an NFC tag and was able to write to one just fine yesterday.
[Nexus 4 Android Development] :
AW: [MOD] Modified NfcNci.apk to poll while screen is off.

Tried to avoid that since they are 4.1 versions, but that's probably nonsense, thanks.
[Nexus 4 Android Development] Stryder5:
Yep, try it out and let me know how it goes for you!
[Nexus 4 Android Development] :
AW: [MOD] Modified NfcNci.apk to poll while screen is off.

Works nicely, appreciate it :)
[Nexus 4 Android Development] umber:
here a zipfile for 4.2.2

its the version from CptanPanic's 1st post

tested with cm10.2
[Nexus 4 Android Development] :
AW: [MOD] Modified NfcNci.apk to poll while screen is off.

<3
[Nexus 4 Android Development] hashworks:
Well, I guess I just crashed my NFC :D

No matter what I flash and no matter how I set the file permissions (with ES File Explorer), NFC disappears from the menu, just like it happened to this guy.

I also tryed umbers latest zip, but this doesn't change anything.

Also re-flashing the latest CM10.2 nightly doesn't seem to change anything.

Any idea?
[Nexus 4 Android Development] Stryder5:
Copy the new Nfc apk to the correct location. Change its permissions. Reboot.
[Nexus 4 Android Development] hashworks:
Yeah, I keep doing that, but nothing changes.

Maybe I adjust the wrong permissions?
[Nexus 4 Android Development] Stryder5:
Make sure you have the right APK for your ROM. Permissions should be 644.
[Nexus 4 Android Development] CptanPanic:
Thanks @umber, I just installed cm10.1 and used your zip of my mod.
[Nexus 4 Android Development] :
AW: [MOD] Modified NfcNci.apk to poll while screen is off.

The 4.2.2 version is supposed to be flashed in recovery.
[Nexus 4 Android Development] hashworks:
Dunno what was wrong exactly..reflashed the ROM several times und wiped some stuff. Now it works.
[Nexus 4 Android Development] thE_29:
When i copy the posted app, Nfc will be removed from my phone.. I dont have any NFC-settings anymore.. Reverted back and have everything again..

I am currently at CM nightly from 15. February.. Will upgrade today and test it again!

Nope, still the same. The apk will kill my Nfc-Service/settings on my Nexus 4.. I have latest nightly CM10.1 with standard kernel and old basebands..
[Nexus 4 Android Development] odeccacccp:
Why do you need this file if you already have the option of settings in NFC? can;t you choose when NFC should be on, there?
[Nexus 4 Android Development] thE_29:
I mean the general "enable NFC" and "enable NFC Android Beam" settings are GONE after i use the APK from this thread..

The phone behaves, as if there is no NFC at all..

When I have time, i will compile a new one based on the cm 10.1 sources...

From which Firmware is that NfcNci.apk?
[Nexus 4 Android Development] thE_29:
Der_schubi made a custom version of CM10.1 build ( i think its based on 25 or 26 CM10.1 build) where NFC is working when screen is ON and lockscreen is ON.

But not when screen is off (of course when screen is ON and lockscreen is OFF, it will work too)

Its just the .apk file, so replace it in /system/app
[Nexus 4 Android Development] Kazliux:
bolded the most important part. rename this file to some name like NfcNci.odex.bak after you copy modified NfcNci.apk

thanks, finally I've got it working.