Solid

For a long, long time I’ve wanted to have a platform where I could store my own data wherever I want, share the data and allow applications to access it while retaining full control of who can access what. For years I’ve wanted to build such a service myself, but I’ve never got anywhere far with it.

But now, for the first time, there is a promising solution coming up. From the father of World Wide Web itself, Sir Tim Berner’s Lee: Solid.

I’ve only briefly looked at the docs, but the idea looks just like I want. I need to look at the implementation some day.

Laravel Notification Channel for Zoner SMS-Gateway

We decided to use Zoner SMS-Gateway for sending SMS messages in a Laravel application I developed for a client. It is a Finnish service for sending SMS messages with a simple HTTP API.

In Laravel, Notification is the abstraction for any kind of message that can be sent via a Notification Channel. Laravel includes implementations for some notification channels, and there are community-provided ones in Laravel Notification Channels site.

There was no notification channel implementation for Zoner, so I created one. As instructed in Laravel Notification Channels site, I made a pull request to get my implementation listed there, but so far there hasn’t been any reaction to it. I wonder if there is anyone updating the site any more. Meanwhile, you can get the implementation from our own GitHub repository.

Timeout at getCurrentPosition in Cordova app on Android

I made a simple Cordova application that wraps the web site of a client. The app asked for the current location using the “official” Geolocation plugin (cordova-plugin-geolocation), but it turned out quite unstable on Android. Sometimes it just stopped providing location. Someone suggested rebooting the phone as a fix, which did help, but is not a very good solution in the long term.

Somewhere I saw that Google suggests using its Play Services API for getting the location, instead of the vanilla Android API. Then I found Google Location Services for Cordova plugin that uses the Play Services location API. Somebody in Stack Overflow suggested that too. The original geolocation plugin gets its location from the webview, which I suppose gets it from the vanilla Android API.

Because the Google Location Services plugin is naturally for Android only, I still use the geolocation plugin on iOS. Here’s the code that uses the Google Location Services plugin if it exists and the default one otherwise:

var locationService = navigator.geolocation;
if (cordova && 'plugins' in cordova && 'locationServices' in cordova.plugins) {
  locationService = cordova.plugins.locationServices.geolocation;
  console.log('Using cordova-plugin-locationservices');
}

locationService.getCurrentPosition(
  function (position) {
    var positionStr = position.coords.latitude + ',' + position.coords.longitude;
    console.log('Got position: ' + positionStr);
    // ...
  },
  function (err) {
    console.log('Did not got position: code=' + err.code + ' message=' + err.message);
    // ...
  },
  {
    enableHighAccuracy: false,
    maximumAge: 30*60*1000, // 30 min
    timeout: 20000 // ms
   }
);