Search code examples
google-chrome-app

Unable to get system.display info in google chrome app


I am new to creating chrome apps and I am trying to create two windows, one on each display/monitor of my computer. I am trying to get the displays' information by using the chrome.system.display.getInfo() but it is just returning undefined.

I've got system.display in permissions for my manifest.json and once I've create a window I open up the console and type in the following:

chrome.system.display.getInfo(function(displayInfo) { console.log(displayInfo); });

As I said before it just returns undefined. From what I understand in the docs the argument should return back an array of objects that contains the info about the displays on the computer but it just returns undefined.

If I just type in chrome.system.display in the console I can see that it returns an object (which it didn't before I put in the permission in the manifest.json) so I'm not sure what I'm missing.


Solution

  • Without seeing more details it is hard to know what is going wrong. One thing I did notice was that there was no sample for using system.display, so I updated the existing system info sample to include this API.

    I managed to do so without running into any troubles. You should download and try the sample here and use it as a starting point for your app.

    If you're still having troubles please ask again here, with more details (i.e. more code).