FORUMS
Remove All Ads from XDA

[MOD] NFC With the Screen Off

1,110 posts
Thanks Meter: 167
 
By Geniusdog254, Retired Recognized Developer on 14th June 2012, 06:12 AM
Post Reply Email Thread
Wow. It's been a long time since I made anything useful. Not being able to use NFC with the screen off has always been a pet peeve of mine with my Nexus, so I figured I'd fix it

This is a modified Nfc.apk, which is the system NFC service that runs at boot. It allows you to scan NFC tags either with the screen totally off, or with the screen on but still at the lockscreen. You get to choose which one you want to flash. Just download one of the zips below, and flash it via recovery (tested with ClockworkMod). To restore to stock, just pick the stock version.

The screen off version means you can ALWAYS scan an NFC tag. Don't have to turn the screen on or anything. Just touch the phone to the tag.

The lockscreen version lets you scan a tag whenever the screen is on, but it doesn't have to be unlocked. You can't scan while the screen is off, but you can just touch the power button to get to the lockscreen and then scan. If you have a passcode, no need to unlock your phone to scan a tag.

This has been compiled against CyanogenMod and tested on my own self-built tree based off CyanogenMod source. There is nothing here that should be specific to that ROM.

Devices
  • Sprint Galaxy Nexus (toroplus)
    • Fully working on CyanogenMod based ROMs
    • Fully functional on most AOKP ROMs. Throws random errors on some, but everything still works.
    • Not functional on some stock ROMs
  • GSM Galaxy Nexus (maguro)
    • Fully working on CyanogenMod based ROMs
    • Fully functional on most AOKP ROMs. Throws random errors on some, but everything still works.
    • Not functional on some stock ROMs
  • Verizon Galaxy Nexus (toro)
    • Untested as far as I know. If you test it let me know
    • Should be similar to other Galaxy Nexus SKUs
  • HTC One X
    • The user StephanSch has created a version for the One X. Get it in this post.
    • Only screen off seems to work, not lockscreen.
    • Don't know if this is for the Qualcomm S4 based One X or the Tegra 3 base. Not sure about carrier versions either.
  • Samsung Galaxy SIII
    • The user mayhemer has created a version for the SIII. Get it in this post.
    • I'm not aware of which version of the SIII this is for, now which ROM. As soon as I have info, I'll update it here.
  • Nexus S
    • Reported working from at least one user. Don't know GSM or CDMA version, nor which ROM.
    • Probably working on any CM9 build for either SKU, and possibly stock or AOKP.

It probably will not work on any manufacturer based skins on any other device.

If you try it on any other device, please let me know how it goes! I'll update the OP with your results!

Also of note, I do not know if this will allow you to use Wallet any differently than you can right now. I don't have any way to test it, and don't personally use Wallet. If you do, let me know whether it works or not so I can update this post!

Liability Disclaimer: As always, I hereby absolve myself of responsibility for any damage you cause to your phone by flashing this. There is inherent risk in modding your device, and by flashing anything in this thread you are taking that risk into your own hands. If something goes wrong, I will try and help, but I am not God.

Source Code Disclaimer: The only code modified here was given under the Apache v2 license. That means that I am not required to release source for this. It is an incredibly simple mod at this point, but I plan on taking it into the next level and creating a patch that makes this an option in settings, rather than a zip you have to flash. I will release source with this, but I want to wait until I clean it up and submit it to the CyanogenMod Gerrit as a full feature, rather than a cheap hack! Sorry if that disappoints anyone, I just wanted to get this out ASAP.

In the meantime, I explain what I'm doing in this post. That should be enough info if you're compiling from source, and might be enough if you are using a Smali edit. If you're critically concerned about it, shoot me a PM or an email and I'll try and help more.

How things stand for Jellybean:
I put this on hold for a while. The further I got into making this a toggleable option in settings, the deeper things ran into the system code. With the big change to Jellybean around the corner, I want to wait until Jellybean becomes the main CM branch so I can avoid the breaks that all the code churn will cause. I'm not done with this, but there's no point in putting the work in to make it fully functional when CM10 is around the corner to break it all. I'll get on it as soon as CM10 becomes closer to release. Before the code freeze for CM10.

In the mean time, @PHtQuE got ahold of me on Twitter and I told him what was happening. I gave him a couple pointers and he got it compiling on Jellybean at the same level it is right now on ICS. I may be wrong, but I believe this is his post right here. Regardless, this is a working screenoff version for JB.
Attached Files
File Type: zip nfcmod_stock.zip - [Click for QR Code] (340.0 KB, 2647 views)
File Type: zip nfcmod_screenoff.zip - [Click for QR Code] (340.0 KB, 4601 views)
File Type: zip nfcmod_lockscreen.zip - [Click for QR Code] (339.9 KB, 2908 views)
The Following 73 Users Say Thank You to Geniusdog254 For This Useful Post: [ View ] Gift Geniusdog254 Ad-Free
 
 
14th June 2012, 06:14 AM |#2  
Geniusdog254's Avatar
OP Retired Recognized Developer
Flag St. Louis
Thanks Meter: 167
 
Donate to Me
More
Reserved, just in case...
The Following 2 Users Say Thank You to Geniusdog254 For This Useful Post: [ View ] Gift Geniusdog254 Ad-Free
14th June 2012, 06:43 AM |#3  
ÜBER™'s Avatar
Recognized Themer
Flag Texas
Thanks Meter: 8,957
 
Donate to Me
More
That will definetly come in good use. Thanks

Sent From My Old Epic 4g via XDA Premium
14th June 2012, 10:52 AM |#4  
Senior Member
Thanks Meter: 274
 
More
This is nice! Thanks! One thing that I thought would be useful is to have a notification pull down toggle for NFC. so you think that's possible?

Sent from my Galaxy Nexus using XDA
The Following 2 Users Say Thank You to pastert33 For This Useful Post: [ View ] Gift pastert33 Ad-Free
14th June 2012, 11:50 AM |#5  
FrostyF7's Avatar
Senior Member
Flag Ann Arbor
Thanks Meter: 261
 
More
This is handy thanks dog lol.

Sent from my Galaxy Nexus
The Following User Says Thank You to FrostyF7 For This Useful Post: [ View ] Gift FrostyF7 Ad-Free
14th June 2012, 02:39 PM |#6  
obsanity's Avatar
Senior Member
Thanks Meter: 478
 
More
Hmmm... I've always been able to use Google wallet with the screen off. I'm not sure about any other nfc use though.
14th June 2012, 03:17 PM |#7  
Senior Member
Flag St. Louis
Thanks Meter: 19
 
More
Awesome man, thanks. Just bought some NFC stickers to mess around with and this was my biggest problem. Really appreciate it.
The Following User Says Thank You to BK553 For This Useful Post: [ View ] Gift BK553 Ad-Free
14th June 2012, 03:20 PM |#8  
BeerChameleon's Avatar
Senior Member
Flag Tucson,Arizona.
Thanks Meter: 1,206
 
Donate to Me
More
Nice!! So the screen of one is only if the screen is off without a lockscreen?
14th June 2012, 03:49 PM |#9  
Geniusdog254's Avatar
OP Retired Recognized Developer
Flag St. Louis
Thanks Meter: 167
 
Donate to Me
More
Quote:
Originally Posted by davidrules7778

Nice!! So the screen of one is only if the screen is off without a lockscreen?

No. Sorry, I'll update the OP to be a little more clear.

Screen off means you can ALWAYS scan an NFC tag. Don't have to turn the screen on or anything. Just touch the phone to the tag.

The lockscreen version lets you scan a tag whenever the screen is on, but it doesn't have to be unlocked. You can't scan while the screen is off, but you can just touch the power button to get to the lockscreen and then scan. If you have a passcode, no need to unlock your phone to scan a tag.


Quote:
Originally Posted by pastert33

This is nice! Thanks! One thing that I thought would be useful is to have a notification pull down toggle for NFC. so you think that's possible?

It's definitely possible. I'm working on getting the option in Settings now, and should have it working by the end of the day. Once there's an option in Settings, it should be super simple to add a notification bar toggle option as well. Haven't messed with that part before, but it's not too dissimilar from WiFi toggling, so I've got code to look at.

I was hoping to get the settings mod done in time to submit it to CM before they started the code freeze for CM9. Well, they went into code freeze this morning so I missed that. I'll still get it submitted ASAP, but don't expect to see it in the initial CM9 official build unless you use the nightlies. I'll of course update everything once I submit the patch and if it gets accepted.
The Following 3 Users Say Thank You to Geniusdog254 For This Useful Post: [ View ] Gift Geniusdog254 Ad-Free
14th June 2012, 05:57 PM |#10  
BeerChameleon's Avatar
Senior Member
Flag Tucson,Arizona.
Thanks Meter: 1,206
 
Donate to Me
More
Quote:
Originally Posted by Geniusdog254

No. Sorry, I'll update the OP to be a little more clear.

Screen off means you can ALWAYS scan an NFC tag. Don't have to turn the screen on or anything. Just touch the phone to the tag.

The lockscreen version lets you scan a tag whenever the screen is on, but it doesn't have to be unlocked. You can't scan while the screen is off, but you can just touch the power button to get to the lockscreen and then scan. If you have a passcode, no need to unlock your phone to scan a tag.




It's definitely possible. I'm working on getting the option in Settings now, and should have it working by the end of the day. Once there's an option in Settings, it should be super simple to add a notification bar toggle option as well. Haven't messed with that part before, but it's not too dissimilar from WiFi toggling, so I've got code to look at.

I was hoping to get the settings mod done in time to submit it to CM before they started the code freeze for CM9. Well, they went into code freeze this morning so I missed that. I'll still get it submitted ASAP, but don't expect to see it in the initial CM9 official build unless you use the nightlies. I'll of course update everything once I submit the patch and if it gets accepted.

Darn it LOL i would love to have one that works with both

Great work tho, i will probaly get the lockscreen one
14th June 2012, 07:04 PM |#11  
agentdr8's Avatar
Senior Member
Flag Cowtown, CA
Thanks Meter: 1,716
 
Donate to Me
More
Any thoughts as to if this will work on the One X? I'm backing up my stock NFC.apk anyhow and am going to test it, but I thought I'd ask in advance.
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes