Thursday, 20 September 2012

Find my phone! on{X} style

I've been toying with the new app / scripting abilities Microsoft have put together for Android. Yes, that is correct, your eyes do not deceive you. Microsoft have released an app, called on{x}, that allows you to write a Javascript to perform certains actions on your Android device at x time, x event (such as when a text message is received) or when your Mode of Transport changes - if nothing else this one is interesting for sure!

Install on{x} from the Play Store here
Join the on{x} community here

I had a look at the 'Recipes' as they're called that Microsoft 'baked' and released for use an decided to take one of their recipes, hack it a little - not too much ! - so it texts a bunch of people to let them know your phone has been stolen. I'll post other examples of modified scripts here too, I say modified because, well I never learnt Javascript, but understand enough to chop and change bits of it.

Add in as many friend variables with different names as you want in the top, remove the double slash to uncomment the variable friend2.

There is an email & texting version of this script in the works.

// Initializing variables
   
 var friend = { name : "Self",phoneNumber : "+441234567890" } ;
//    var friend2 = { name : "Otherhalf",phoneNumber : "+441234567809" } ;
 var messageText = "where?";

 // End of variables initializing

 console.log('Started script: When ' + friend.name + ' texts me \"' +  messageText + '\" reply automatically with my location');

    //  Register callback on sms received event
    device.messaging.on('smsReceived', function (sms) {
        if (sms.data && sms.data.body.toLowerCase() === messageText.toLowerCase()) {
            // getting location from cell, which is accurate enough in this case, time interval is 100  milliseconds, to get immediate location sample
            var locListener = device.location.createListener('CELL', 100);
            locListener.on('changed', function (signal) {
                // stop listening to location changed events after getting the current location
                locListener.stop();

                var mapUrlPattern = 'https://feeds.onx.ms/maps?wp=lat,lon';
                var mapUrl =  mapUrlPattern.replace(/lat/g, signal.location.latitude).replace(/lon/g, signal.location.longitude);

                // sending text message  with the current location ro predefined numbers in the initializing variables section up top
               
                device.messaging.sendSms({
                        to: friend.phoneNumber ,
                        body: 'I am here, come get me! ' + mapUrl
                    },

/* Remove the comments from the below section, the slash and star's to enable the second person to text, copy and past the code below between the slash and star, replace the friend2 with another variable name defined at the top to text another person, enable a many of these alerts as you want! */

               /*device.messaging.sendSms({
                        to: friend2.phoneNumber ,
                        body: 'I am here, come get me! ' + mapUrl
                    }, */
               
               
                // reply to sender with current location     
                device.messaging.sendSms({
                        to: sms.from ,
                        body: 'I am here, come get me! ' + mapUrl
                    },       
                   
                    function (err) {
                        if (err) {
                            console.error('Error sending text message: ' + JSON.stringify(err));
                        }
                    }
                ));
            });
            locListener.start();
        }
    });
    console.log('Completed script: When ' + friend.name + ' texts me \"' +  messageText + '\" reply automatically with my location');

Monday, 10 September 2012

Is NFC over rated? We need an NFC 2.0 revolution!

What's all this hype about NFC anyway? Well, I've delved into the world of NFC to find out.

I got myself one of those new fandangled Galaxy SIII smartphone's with all the tech a geek could need - for at least the next 2 months until the next big thing comes along - It's got Wifi, BlueTooth, 4.8" screen, oh and NFC too. Knowing it had NFC built in was great. But I had nothing to use with the NFC, except for beaming pictures I had taken with the phone over to my wife's new fandangled Galaxy SIII and vice versa. After everything that has been drummed about about NFC by the tech world and most notably Google, I was under the impression NFC was going to be super freakin' awesome, man!

So being a geek I purchased a variety of tags from RapidNFC to test my new phone's capabilities out, while waiting the not-so-Rapid week long wait for the tags to arrive, I took to reading the NFC Hacking forum on XDA Developers to glean as much information as possible on how you go about programming the tags and what you can do with the tags, I learnt you need a program to be able to write to the tags and the default choice seems to be NFC Task Launcher, it is a really nice NFC tag programming app with a dead simple interface and I can see why it's the default choice on XDA Developers. While NFC Task Launcher is great and I applaud them for their work, we need change at a higher level.

What I also learnt is that NFC has it's limitations. To store anything other than basic vCards, URL's, Plain Text or an SMS, you will need to have the app that programmed the tag installed on your NFC device for it to know what to do when it reads the tag. Kindly, any tag that contains such advanced features programmed with NFC Task Launcher will direct you to their app page on Google Play if you don't have it installed, unfortunately this uses valuable bytes of the tags limited capacity, but keep in mind the app is provided for free and it's also helpful as it will get people to install the app so they can read it.

I think the main downfall of NFC is the lack of use case standards. Sure using it for a vCard in a business card is a use, as is a URL for products in shops. What gets me is plain text tags? hmm, not a whole lot of use, unless you want to give clients info to read while in reception, such as a brochure, but you'd need a one of the larger tags and possibly multiple tags for them to scan. Then we have SMS tags, again not a whole lot of use and most likely to be the most unused tag, maybe have a tag that sends your other half a text to say when you're leaving work, problem is that's all it will do and they'll get the SMS unless there are rules to say only send text if tag scan was between this time on these days, otherwise your other half will receive random text messages.

What I'm proposing to the NFC Forum (the official international body made up of many of the large international organisations that takes care of defining NFC standards) do is design a set of standards that will allow tags to perform some of the more advanced features most mobiles are capable of. This will take the input of mobile operating system vendors, such as Google (Android/Chrome OS?), Microsoft (Windows & Windows Phone 8), Samsung (Bada, Android) and when Apple decide to enter the NFC world they can follow the others or cock it up by not following the standards.

The new standards I'm talking about are enabling/disabling Wifi, BlueTooth, mobile data (2G/3G/4G), GPS and sound volume muting, connecting to wifi access points (for guests & staff, easily change the WPA2 key daily/weekly in a small business without the need for a complex network with RADIUS servers), BlueTooth devices (e.g car Bluetooth) very basic tasks that at the moment can only be utilized with the use of a program such as NFC Task Launcher.

What everyday people will have to do for the time being is install an app that can read the device's tag so it knows what to do with it, most devices in the home (multimedia devices for example) could connect with a mobile using BlueTooth.

All I know is that for NFC to really take off it's going to need a change at it's core, the only way that will happen is if the NFC Forum implement the changes.

So please, dear reader sign my petition and know that you too have told the NFC Forum you want change.
http://www.change.org/petitions/nfc-forum-update-the-standards-and-include-more-functionality#