Welcome to XDA

Search to go directly to your device's forum

Register an account

Unlock full posting privileges

Ask a question

No registration required
Post Reply

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

OP CptanPanic

3rd December 2012, 02:22 AM   |  #1  
OP Senior Member
Thanks Meter: 69
 
141 posts
Join Date:Joined: Jun 2011
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, 944 views)
File Type: apk NfcNci.mod.4.2.2.apk - [Click for QR Code] (345.5 KB, 1762 views)
Last edited by CptanPanic; 18th February 2013 at 02:12 AM. Reason: Added new version
The Following 28 Users Say Thank You to CptanPanic For This Useful Post: [ View ]
3rd December 2012, 05:47 AM   |  #2  
jerdog's Avatar
Developer Committee / OEM Relations / XDA Portal Team - Harbinger of Doom
Flag Gallifrey
Thanks Meter: 4,350
 
6,165 posts
Join Date:Joined: May 2007
More
Great work. Moving to Android Development

Sent from my Nexus 4 using XDA Premium HD app
The Following User Says Thank You to jerdog For This Useful Post: [ View ]
3rd December 2012, 06:13 AM   |  #3  
Member
Thanks Meter: 9
 
54 posts
Join Date:Joined: 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?
3rd December 2012, 07:54 AM   |  #4  
Senior Member
Flag Charlottesville
Thanks Meter: 56
 
350 posts
Join Date:Joined: Jun 2011
More
Quote:
Originally Posted by Vertana

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.
3rd December 2012, 10:53 AM   |  #5  
Senior Member
Thanks Meter: 47
 
339 posts
Join Date:Joined: 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?
3rd December 2012, 12:07 PM   |  #6  
Member
Thanks Meter: 4
 
91 posts
Join Date:Joined: 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
Last edited by brium13; 3rd December 2012 at 12:10 PM.
3rd December 2012, 12:30 PM   |  #7  
Member
Thanks Meter: 13
 
58 posts
Join Date:Joined: Dec 2011
Quote:
Originally Posted by brium13

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!
Last edited by G405T; 3rd December 2012 at 12:40 PM.
The Following User Says Thank You to G405T For This Useful Post: [ View ]
3rd December 2012, 02:24 PM   |  #8  
Member
Thanks Meter: 4
 
91 posts
Join Date:Joined: Jun 2007
Quote:
Originally Posted by G405T

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.
3rd December 2012, 03:06 PM   |  #9  
Member
Thanks Meter: 13
 
58 posts
Join Date:Joined: Dec 2011
Quote:
Originally Posted by brium13

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!
Last edited by G405T; 3rd December 2012 at 03:33 PM.
The Following User Says Thank You to G405T For This Useful Post: [ View ]
3rd December 2012, 07:30 PM   |  #10  
Senior Member
Flag Charlottesville
Thanks Meter: 56
 
350 posts
Join Date:Joined: Jun 2011
More
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: [ View ]
Post Reply Subscribe to Thread

Tags
nfc
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes