Show me the value of bitcoin when I unlock the phone

It simply shows you the current value of bitcoin when you unlock the phone.

It shows you the current value of one bitcoin, based on the data from BTC-E market.

I accept donations at 1PoHhTNZnez5ZC68249t8seLy7AwsvA5yN

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!');
    });
});

Recipe Wall

1,303

Views