Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Application run for the first time

Hello, im creating an app that is using the file transfer for json information from a 3rd part server.

This information only needs to be updated once a week.  So im using wakeInterval and sit it to 4 days.

 

Now my only problem is getting the file onto the watch the first time the app is installed.  What is the cleanest way of doing that?  

 

right now i have a try to catch the readFileSync exception reached on error, which i then tried to fire a peer message to the device, but there seems to be a timing issue, because i keep getting an exception.(seems the port is not open yet).  So i have to just keep doing a setInterval until the peer socket is open? below is what im using wonder if there is a cleaner way.

 

var timer = setInterval(function(){
if (messaging.peerSocket.readyState === messaging.peerSocket.OPEN) {
messaging.peerSocket.send({"command":"getGames", "week":"4"});
clearInterval(timer);
}
},4000)

Best Answer
0 Votes
1 REPLY 1

thank you for sharing!!

Best Answer
0 Votes