It simply shows you the current value of bitcoin when you unlock the phone.
To use this on{X} Recipe, simply copy the code below and modify if needed.
device.screen.on("unlock", function(){
device.ajax(
{
url: 'https://btc-e.com/api/1/ticker',
type: 'GET'
},
function onSuccess(body, textStatus, response) {
var parsedBody;
if(!(body && (parsedBody = JSON.parse(body)))) {
var error = {};
error.message = 'invalid body format';
error.content = body;
console.error('error: ',error);
}
var notification = device.notifications.createNotification('Bitcoin value');
notification.content = parsedBody.ticker.sell + "USD";
notification.on('click', function(){
device.browser.launch('https://btc-e.com/exchange/btc_usd');
});
notification.show();
console.info('successfully received http response from btc-e!');
});
});
Views