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

Companion launch issues

I am having some issues in communicating with the companion. It seems to start only once in a while. 

My starting code is the same as of a new project from studio with file transfer.

 

Companion starts only once in a while. Also timestamp seems to be completely off. Please see below.

Is there a basic launch code to insert in the app/index.js so that it goes straight to start companion code?

 

  • [9:05:03 PM]App Started[HOST]
  • [9:08:02 PM]App Closed[HOST]
  • [9:08:22 PM]App Started[HOST]
  • [9:08:49 PM]App Closed[HOST]
  • [9:11:01 PM]App Started[HOST]
  • [9:12:38 PM]App Closed[HOST]
  • [9:12:43 PM]App Started[HOST]
  • [8:51:02 PM]Loaded and evaluated: file:///android_asset/bootstrap.js[HOST]
  • [8:51:02 PM]Companion Started

My code in the app:

import document from "document";
import { inbox } from "file-transfer";
import fs from "fs";

// console.log("App Started");

let statusText = document.getElementById("status");
statusText.innerText = "Waiting...";

// Event occurs when new file(s) are received
inbox.onnewfile = () => {
  console.log("New file!");
  let fileName;
  do {
    // If there is a file, move it from staging into the application folder
    fileName = inbox.nextFile();
    if (fileName) {
      console.log(`Received File: <${fileName}>`);
      let data = fs.readFileSync(fileName, "json");
      statusText.innerText = `Received: ${data}`;
    }
  } while (fileName);
};
Best Answer
0 Votes
2 REPLIES 2

Please retry with the new firmware which is coming very soon!

Best Answer

Still actual even using latest firmware.

Best Answer
0 Votes