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.
/* 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! */// 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
},
/*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');