I've only ever used the pebble SDK, never cloud pebble, but this is still relevant I believe. In your .js file though, you can test internet connectivity by navigator.onLine
. I wrote a test app on my watch to test this and it worked. When I had internet connectivity it returned true, when I turned off all data and wifi it returned false. Note however that when the app isn't open the .js file won't run at all, so instead of waiting for an internet connectivity notification, you can wait for a ready status from the .js file. If the watch doesn't receive the ready notification you could display some message to the user indicating that they should open the app (If you want to be sure about internet connectivity then test for it like I show below).
internet_status = navigator.onLine;
console.log("Is the browser online? " + internet_status);
Pebble.addEventListener('ready', function() {
// PebbleKit JS is ready!
console.log('PebbleKit JS ready!');
var dict = {
'status': internet_status
};
Pebble.sendAppMessage(dict, function() {
console.log('Message sent successfully: ' + JSON.stringify(dict));
}, function(e) {
console.log('Message failed: ' + JSON.stringify(e));
});
});