Shared publicly  - 
 
I worked on a patch to enable profile switching using NFC tags with CM9, and it's now merged. This will be available in the upcoming builds for NFC enabled devices such as the Galaxy Nexus and Nexus S. Here's how it works..

1. Set up the profiles you like. A profile that I often use is a "Car" profile which disables the lockscreen.
2. Put a tag in this location (e.g. your car).
3. Select "Profile settings" then touch the settings icon for the profile you want to be able to toggle.
4. Touch the NFC icon on the bottom left.
5. You'll then be prompted to touch the phone to the tag you want to write. Hold the phone to the tag to write the profile information to it.

That's it. You can now simply tap your phone on this tag (when you get into your car) to enable the profile. Tapping it a second time will restore the previous profile (when you get out of your car).

Note that you need to unlock the device first, as with any other NFC code.
279
132
Lance Miller's profile photoDerek Ross's profile photoToni Barrera Arboix's profile photoDavid LaCivita's profile photo
96 comments
 
Now that is what I'm talking about. No need for third party app. I have one question would you be able to format, wipe clean a tag that was already written?
 
Just ordered some NFC tags to do just this, but this will make it super easy.
 
I was thinking of using something like this. I just don't use profiles enough to do it. It is a nice addition though
 
Now I just wait for CM9 for the Sprint GNex
 
+Ben Murphy I'm not sure that NFC Task Launcher has support for CM profiles, though. We can do some significantly more powerful stuff with profile that an app can't do, like disabling the lockscreen.

And if you have ideas on how to make profiles do more cool things (+Benji Hertel) let's code it :)
 
Ordered a bunch of tags. Looking forward to trying it.
 
+Steve Kondik I was just saying that what I can do with the profile is more or less what I was going to use NFC Task Launcher for.
 
Can your profile run Tasker scripts? I currently use NFC Task Launcher to run a "car dock" script that disables the lock screen, turns on the speaker phone, and enables text to speech of SMS messages.
 
Is the profile information actually stored on the tag, or is it just an id that calls a profile with that id on your device? In other words, if you wipe or get a new device, would your tags still work without having to do it all over again?
 
Oops. I mean disable screen timeout. Not lock screen
 
+Lance Miller if I understand +Steve Kondik it seems that the profiles will be written to the tags themselves allowing them to be used whenever until you re-write the tag itself.
 
Note that you need to unlock the device first, as with any other NFC code. - that actually sucks. We finally got the ability to take pictures w/o unlocking the phone after many years of suffering. Same with NFC...
 
Just brilliant - can't WAIT to get my HTC One X for all the CM9 goodness :)
 
+Lance Miller If you wipe your device, you need to rewrite the tags since they only store the unique ID of the profile and not the profile configuration itself. I went this route in order to support shitty ultralight tags that have very limited storage capability.
 
+Denys Dmytriyenko From what I understand about NFC Tags, they just store a string, the length of which is dependent on the type of tag. If that's the case, you should be able to serialize an array, or use JSON to store all of the functions that the device should perform upon scan.
 
+Steve Kondik I had question about tag support based on nfc hardware. How can I get HID iClass tags to read? I know they aren't supported on my nexus s. Can this be coded to be supported later on?
 
Thanks, +Steve Kondik. That inevitably leads me to my next question: can you backup and restore profiles?
 
+Mitch F Not yet, this just supports the CM profiles. I'm open to suggestions on how to make it better though.
 
I just ordered a few NFC tags, I currently use an app to do my settings for Home, Work and Car but I love this idea! finds a CM9 build for his NS4G
 
+Denys Dmytriyenko I think it's a big security hole, especially if you allow the profile to disable the lockscreen. Thinking about it more, it might not be so bad since the profiles have a UUID which is unique to that device and not easily guessed. I'm pretty sure the NFC hardware in the phone doesn't actually power up until the phone is unlocked, though.
 
Hmm, that's strange. I was actually thinking about the basic RFID usage, where tags are passive antenna transmitters only powered in the presence of a reader (phone). In that case it shouldn't be too unsecure to always read tags when in the range. What to do with them is up to you and your phone... +Jim Avila +Paul Leonard +Lance Miller
 
+Denys Dmytriyenko Yeah, this is correct. I just want to avoid the unlikely situation where someone can steal a phone and be able to unlock it by just tapping it on a tag with some data. The 128-bit UUID is probably okay though. In that case, you'd need to steal the car or the front door too :)
 
+Steve Kondik isn't it possible to associate a profile to the fact that the tag is "in range" / "out of range" instead of touching the tag twice? that would allow to put a tag on the phone holder for instance (in the car)
 
great job man - we're always developing new NFC apps - this is a step in the right direction adding this functionality baked right into CM9 - i'll make a video when this gets pushed out to maguro nightlies :) thx!
 
+Sébastien Débia No, NFC is a very-short range technology. You'd have to keep the phone within one inch of the tag :)
 
+Steve Kondik yes that's what I mean, if you stick the tag on the phone holder, holding the phone ... that's far less than 1 inch :)
 
Ahh good point. The code does not support this, and I'm not sure that Android actually does either. You get an intent when it detects a tag in range, and that's it.
 
Ok, but I don't care I don't have a NFC enabled phone :D I just thought that would be sweet. I currently use a tasker profile linked to the fact that the phone is connected to the car via bluetooth, and that's perfectly fine. Nothing to do, it works without interaction and reverts back when I leave the car.
 
+Christen Perey Ordered mine from tagsfordroid.com, ordered white ones and they have 3M brand adhesive on the back, about the size of a quarter. In-fact here is one I placed at work today, back side of my Keyboard (Logitech K750) so I can tap my phone when I get in to apply my work settings, http://bit.ly/HQ0gLY
 
Wow, very crafty use of NFC. Great job!
 
is the pic of you really you, if so... Idk... watevs
 
nothing, i just say it
 
no and i do not want one or need one
 
I'd love to use this to switch sessions at my PC at home :)
 
any word on mass cm9 release?? i know eta's are taboo, but a hint would be great.
 
+caroline russelle maybe you should volunteer your time and obvious great sense in aesthetics to an open source project and help solve these problems.
 
To remind me about that I made a lego jet that I call the shuttle muttle !
 
Perfect. Thanks +Steve Kondik can't wait to use this myself. I'm sure many others will love it too.
 
Then you're requiring users to buy NFC writable stickers...which is no big deal the cost next to nothing.
 
Grand idea: Cyanogenmod-branded NFC stickers?
 
3 and a dot (its got it all)
 
Any chance we can do something like this on a vanilla Nexus 3? More importantly... how do you get the car mode app on this device, its not available in Play?!#@
 
Props I'm adding you.
 
+Renaud Lepage I'm not sure that AOSP would accept the profiles code since it falls into the domain of "large new feature" and doesn't match Google's roadmap :(
 
+Steve Kondik is it possible to use a single tag with two phones? E.g. learning a tag id instead of writing it to the tag.
 
+Felix Bechstein Sure it is. I just made a small app doing it.
Just read the tag ID once and select the action. You keep all data on the phone instead of the tag.
The same tag could even make different actions on diffrent phones.
 
Don't mean to be a douche... but English please?
 
+Felix Bechstein I meant any tag with an ID already assigned. You just read the ID with the app and assign any task to it. The tag would act as a trigger for any action. Just wanted to tell you that what you wanted was possible. Sorry if I misunderstood the feature.
 
Wewt! Just ordered some tags, thanks man!
Zach M
 
Thanks for all the hard work +Steve Kondik . Just waiting for my gynecologist to show up this evening. Knew I should have ordered those tags the other day.
 
So I'm new to CM9 - Is thing a variant of a given Android OS (like ICS) that I have to root my phone with? I'd love to have an app that does this, but I'm not willing to root my phone and blow out the factory OS just to get this feature.
Zach M
 
+Tyler Vigeant - yep. You have to unlock your bootloader and flash the rom. & it is ICS with awesome additions & tweaks.
 
+Tyler Vigeant there's an app that does basically this. This patch only puts such a feature [ not the same code as the other app ] as part of the OS core.
Zach M
 
Thanks for clarifying +Renaud Lepage . I haven't had time to look into that deep yet.
 
+Steve Kondik are there any plans to add the possibility to launch apps or activities in the Profiles?
For example, if you set a Car profile (disable wi-fi, enable GPS and Bluethooth) it would be excellent if it could launch Navigation automatically, so the only thing for the user to add would be the destination.
 
Just loaded CM9 for this feature. My only suggestion is to have the option so when it reads the tag of the current profile that it doesn't go back to the previous profile. For example, I have the nfc tag sitting on my nightstand. As I plan to go to bed, I put my phone down and it goes into the night profile. If I then look at the phone during the night and put it back down, it will revert back to my profile with all the sounds turned back on. Not the way to keep a happy wife. I have the same issue in my car. It is double reading the car profile and turning off Bluetooth.

Great feature just hoping it can get incrementally better.
 
Had some NFC stickers shipped to me. Tried this feature out today - it's great - love the simplicity.

My suggestion is along the lines of +Jeffrey Lewis 's comment. Double-scanning a chip should either do nothing or revert to a "default" profile - rather than switching back to the previously selected profile. It's requests like this that allow CM to get quickly out of hand, complexity-wise, but a little more configurability would be nice.

Thanks for the code! I'll be off placing stickers everywhere..
 
Just got my tags... This is great! Question, would it be feasible to have profiles also set the phone ring tone?
 
Hi +Steve Kondik . I'm trying to do this now..
I can't get the NFC tag to work unless I'm in the car profile settings (then it works).. What am I doing wrong?
+Renaud Lepage any ideas?
 
You need to go in a profile, then click the tag to program a tag. To use the tag, you need to unlock the phone, then scan the tag.
 
+Steve Kondik I agree with +Grace Carlyle, running an app and/or activity via CM profiles would be awesome and would totally replace the need for a 3rd party app who allows this.
 
Great! Would be fantastic if CM included the Nfc polling option found in +AOKP, which enables NFC to be enabled while in lock screen.
Add a comment...