5,606,650 Members 36,842 Now Online
XDA Developers Android and Mobile Development Forum

[MOD] NFC With the Screen Off

Tip us?
 
Geniusdog254
Old
(Last edited by Geniusdog254; 1st August 2012 at 07:23 PM.) Reason: Jellybean info
#1  
Geniusdog254's Avatar
Recognized Developer - OP
Thanks Meter 165
Posts: 1,094
Join Date: Jan 2009
Location: St. Louis

 
DONATE TO ME
Default [MOD] NFC With the Screen Off

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, 2023 views)
File Type: zip nfcmod_screenoff.zip - [Click for QR Code] (340.0 KB, 3232 views)
File Type: zip nfcmod_lockscreen.zip - [Click for QR Code] (339.9 KB, 2167 views)
Follow me on Twitter @Geniusdog254

If you like my work, please buy one of my apps on the Market or donate!
  • Reflex-A-Tron - A colorful, addicting, & fun game to test yourself & challenge friends for only $.99!
  • Search2Play - Control your music with your device's buttons!
  • Task'd - A beautiful to-do list app!

Phones:
Android Dev Phone 1 - Dec. '08
Rogers HTC Dream - Sept. '09
AT&T Nexus One - March '10
Motorola Droid - Apr. '10
HTC Evo - Jun. '10
HTC Evo 3D - Jun. '11
Sprint Galaxy Nexus - May '12
The Following 72 Users Say Thank You to Geniusdog254 For This Useful Post: [ Click to Expand ]
 
Geniusdog254
Old
#2  
Geniusdog254's Avatar
Recognized Developer - OP
Thanks Meter 165
Posts: 1,094
Join Date: Jan 2009
Location: St. Louis

 
DONATE TO ME
Reserved, just in case...
Follow me on Twitter @Geniusdog254

If you like my work, please buy one of my apps on the Market or donate!
  • Reflex-A-Tron - A colorful, addicting, & fun game to test yourself & challenge friends for only $.99!
  • Search2Play - Control your music with your device's buttons!
  • Task'd - A beautiful to-do list app!

Phones:
Android Dev Phone 1 - Dec. '08
Rogers HTC Dream - Sept. '09
AT&T Nexus One - March '10
Motorola Droid - Apr. '10
HTC Evo - Jun. '10
HTC Evo 3D - Jun. '11
Sprint Galaxy Nexus - May '12
The Following 2 Users Say Thank You to Geniusdog254 For This Useful Post: [ Click to Expand ]
 
‹BERô
Old
#3  
‹BERô's Avatar
Recognized Themer
Thanks Meter 8819
Posts: 13,739
Join Date: Nov 2011
Location: Marble Falls, TX

 
DONATE TO ME
That will definetly come in good use. Thanks

Sent From My Old Epic 4g via XDA Premium
Nexus 5: Banks RastaKat / Faux Mainline
Nexus 7 FHD: Stock Rooted 4.4.2 / Faux Mainline
___________________________



 
pastert33
Old
#4  
Senior Member
Thanks Meter 243
Posts: 1,632
Join Date: Oct 2007
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: [ Click to Expand ]
 
FrostyF7
Old
#5  
FrostyF7's Avatar
Senior Member
Thanks Meter 257
Posts: 1,027
Join Date: Apr 2012
Location: Ann Arbor
This is handy thanks dog lol.

Sent from my Galaxy Nexus


The Following User Says Thank You to FrostyF7 For This Useful Post: [ Click to Expand ]
 
obsanity
Old
#6  
obsanity's Avatar
Senior Member
Thanks Meter 422
Posts: 1,737
Join Date: Jun 2010
Hmmm... I've always been able to use Google wallet with the screen off. I'm not sure about any other nfc use though.
Nexus 5 Stock(moded) un-rooted
Franco's Kernel AMOLED Gama settings | proper values
Volume+ = Louder Speaker

Guides:
Automatic backlight
Proper FULL wipe
 
BK553
Old
#7  
Senior Member
Thanks Meter 18
Posts: 117
Join Date: Jan 2008
Location: St. Louis
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: [ Click to Expand ]
 
BeerChameleon
Old
#8  
BeerChameleon's Avatar
Senior Member
Thanks Meter 1204
Posts: 16,134
Join Date: Aug 2008
Location: Tucson,Arizona.

 
DONATE TO ME
Nice!! So the screen of one is only if the screen is off without a lockscreen?
 
Geniusdog254
Old
(Last edited by Geniusdog254; 14th June 2012 at 05:34 PM.)
#9  
Geniusdog254's Avatar
Recognized Developer - OP
Thanks Meter 165
Posts: 1,094
Join Date: Jan 2009
Location: St. Louis

 
DONATE TO ME
Quote:
Originally Posted by davidrules7778 View Post
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 View Post
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.
Follow me on Twitter @Geniusdog254

If you like my work, please buy one of my apps on the Market or donate!
  • Reflex-A-Tron - A colorful, addicting, & fun game to test yourself & challenge friends for only $.99!
  • Search2Play - Control your music with your device's buttons!
  • Task'd - A beautiful to-do list app!

Phones:
Android Dev Phone 1 - Dec. '08
Rogers HTC Dream - Sept. '09
AT&T Nexus One - March '10
Motorola Droid - Apr. '10
HTC Evo - Jun. '10
HTC Evo 3D - Jun. '11
Sprint Galaxy Nexus - May '12
The Following 3 Users Say Thank You to Geniusdog254 For This Useful Post: [ Click to Expand ]
 
BeerChameleon
Old
#10  
BeerChameleon's Avatar
Senior Member
Thanks Meter 1204
Posts: 16,134
Join Date: Aug 2008
Location: Tucson,Arizona.

 
DONATE TO ME
Quote:
Originally Posted by Geniusdog254 View Post
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

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes