Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,804,884 Members 52,561 Now Online
XDA Developers Android and Mobile Development Forum

[MOD] Modified NfcNci.apk to poll while screen is off.

Tip us?
 
CptanPanic
Old
(Last edited by CptanPanic; 18th February 2013 at 01:12 AM.) Reason: Added new version
#1  
Senior Member - OP
Thanks Meter 69
Posts: 137
Join Date: Jun 2011
Default [MOD] Modified NfcNci.apk to poll while screen is off.

I have modified the default polling mode of NfcService.java to poll for Nfc Tags even when the screen is off. This is done for the Nexus 4. To install move the old NfcNci.apk/odex from /system/app to keep just in case, and then just copy over the modified NfcNci.apk and change the permissions to 644. I used adb shell, and adb push to move and install the file in recovery mode, but any way should work. This is my first android development, so this may not work for everyone.

Update:
Just to clarify, this is made for stock 4.2.1

Update: 2/17/13
I have made a new version for stock 4.2.2. Just download copy to /system/app/NfcNci.apk and rename /system/app/NfcNci.odex file.
Attached Files
File Type: apk NfcNci.apk - [Click for QR Code] (345.4 KB, 862 views)
File Type: apk NfcNci.mod.4.2.2.apk - [Click for QR Code] (345.5 KB, 1567 views)
The Following 28 Users Say Thank You to CptanPanic For This Useful Post: [ Click to Expand ]
 
jerdog
Old
#2  
jerdog's Avatar
Developer Committee / OEM Relations / XDA Portal Team - Harbinger of Doom
Thanks Meter 4,204
Posts: 5,924
Join Date: May 2007
Location: Gallifrey
Great work. Moving to Android Development

Sent from my Nexus 4 using XDA Premium HD app


 

Quote:
Notify your physician if after exposure to XDA n00bs you experience any of the following symptoms: rapid or irregular heartbeat, chest pain, shortness of breath, leg cramps, headache, nervousness, irritability, sleeplessness, tremors, change in appetite, weight gain or loss, vomiting, diarrhea, excessive sweating, heat intolerance, fever, changes in menstrual periods, hives or skin rash, or any other unusual medical event.
The Following User Says Thank You to jerdog For This Useful Post: [ Click to Expand ]
 
Vertana
Old
#3  
Member
Thanks Meter 9
Posts: 54
Join Date: Jul 2011
I appreciate the work as I'm positive it'll help a lot of people, but I'm curious how this affects battery life. For anyone using it, have you noticed a significant drop in battery life?
 
aznxk3vi17
Old
#4  
Senior Member
Thanks Meter 56
Posts: 350
Join Date: Jun 2011
Location: Charlottesville
Quote:
Originally Posted by Vertana View Post
I appreciate the work as I'm positive it'll help a lot of people, but I'm curious how this affects battery life. For anyone using it, have you noticed a significant drop in battery life?
I'm about to get it on my phone, will report on how it affects battery life later tomorrow.
 
steslatt
Old
#5  
Senior Member
Thanks Meter 47
Posts: 323
Join Date: Oct 2010
Great work, thanks a lot. Don't suppose you could do a version that works without unlocking the screen just when waking the device? So it wouldn't work with screen off but would when you pressed the power button. If you know what I mean?
 
brium13
Old
(Last edited by brium13; 3rd December 2012 at 11:10 AM.)
#6  
Member
Thanks Meter 4
Posts: 90
Join Date: Jun 2007
Hello, thank you for the work, but it does not work for me.

I use CyanogenMod 10.1, when I replace the modified file no longer works the NFC and NFC menu also disappears

An idea?

thank you
HP Touchpad - CyanogenMod 9
Nexus 4 - CyanogenMod 10.1
 
G405T
Old
(Last edited by G405T; 3rd December 2012 at 11:40 AM.)
#7  
Member
Thanks Meter 13
Posts: 58
Join Date: Dec 2011
Quote:
Originally Posted by brium13 View Post
Hello, thank you for the work, but it does not work for me.

I use CyanogenMod 10.1, when I replace the modified file no longer works the NFC and NFC menu also disappears

An idea?

thank you
I just did this out myself and had similar issues on the jellytime rom.. To fix it you need to extract/pull original apk from your rom (either the original zip or your backup if you have one) and then overwrite the classes.dex file in to old apk with the classes.dex file out of CptanPanics apk (you can do this with any archive manager capable of opening a zip file!).

Flash you modded original apk file and it should then work fine


And thanks for the mod!
My Device(s)
- [2012] Nexus 4
- [2012] Nexus 10

Past Devices: HTC Desire, HTC Sensation
The Following User Says Thank You to G405T For This Useful Post: [ Click to Expand ]
 
brium13
Old
#8  
Member
Thanks Meter 4
Posts: 90
Join Date: Jun 2007
Quote:
Originally Posted by G405T View Post
I just did this out myself and had similar issues on the jellytime rom.. To fix it you need to extract/pull original apk from your rom (either the original zip or your backup if you have one) and then overwrite the classes.dex file in to old apk with the classes.dex file out of CptanPanics apk (you can do this with any archive manager capable of opening a zip file!).

Flash you modded original apk file and it should then work fine


And thanks for the mod!
hello, thank you for your help, I made the handling but it still does not work!

I replaced the file with 7zip classes.odex are weight is 343Kb instead of 345kb

An idea?

Thank you in advance.
HP Touchpad - CyanogenMod 9
Nexus 4 - CyanogenMod 10.1
 
G405T
Old
(Last edited by G405T; 3rd December 2012 at 02:33 PM.)
#9  
Member
Thanks Meter 13
Posts: 58
Join Date: Dec 2011
Quote:
Originally Posted by brium13 View Post
hello, thank you for your help, I made the handling but it still does not work!

I replaced the file with 7zip classes.odex are weight is 343Kb instead of 345kb

An idea?

Thank you in advance.
.odex? was that a typo? Surely your CM rom is de-odexed?

The file size sounds right, so assuming you did that correctly and pushed the apk to /system/app with adb; the next best thing to check would be that you have set the permissions of the apk to 644.. for example:

->adb remount
->adb shell
->su
->chmod 644 /system/app/NfcNci.apk

If that doesnt solve your problem, Im not sure that I can help without trying it out for myself. Also, make sure you have copied the classes.dex to and from the right apks and them pushed the original apk back!! Its easy to mix them up!
My Device(s)
- [2012] Nexus 4
- [2012] Nexus 10

Past Devices: HTC Desire, HTC Sensation
The Following User Says Thank You to G405T For This Useful Post: [ Click to Expand ]
 
aznxk3vi17
Old
#10  
Senior Member
Thanks Meter 56
Posts: 350
Join Date: Jun 2011
Location: Charlottesville
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.

The Following User Says Thank You to aznxk3vi17 For This Useful Post: [ Click to Expand ]
Tags
nfc
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes