Sunday, February 16, 2014

Chrome Store Manifest

  1. {
  2. "app": {
  3. "launch": {
  4. "local_path": "TetrahedronTwister.html"
  5. }
  6. },
  7. "icons": { "16": "logo16.png",
  8. "128": "logo128.png" },
  9. "manifest_version": 2,
  10. "minimum_chrome_version": "23",
  11. "name": "Name of Your App or Game Here",
  12. "offline_enabled": true,
  13. "permissions": [ "storage" ],
  14. "version": "1.0.3"
  15. }
 So here's an example of what the manifest will look like. You'll save it as manifest.json and its just a simple text file.  So what do we have going here?

Declare what to open:

1  {
2     "app": {
3        "launch": {
4           "local_path": "NameOfYourWebUsually____index.html"
5        }
6     },

or if you want one of those "desktop" looking apps:

1  {
2     "app": {
3        "background": {
4           "scripts": "main.js"
5        }
6     },

main.js:

  1. /**
  2. * Listens for the app launching then creates the window
  3. *
  4. * @see http://developer.chrome.com/trunk/apps/app.runtime.html
  5. * @see http://developer.chrome.com/trunk/apps/app.window.html
  6. */
  7. chrome.app.runtime.onLaunched.addListener(function() {
  8. // Center window on screen.
  9. var screenWidth = screen.availWidth;
  10. var screenHeight = screen.availHeight;
  11. var width = 1280; //Size of your game's screen resolution's width, add space for ads
  12. var height = 720; //Size of your game's screen resolution's height, add space for ads
  13. chrome.app.window.create('NameOfYourWebUsually____index.html', {
  14. bounds: {
  15. width: width,
  16. height: height,
  17. left: Math.round((screenWidth-width)/2),
  18. top: Math.round((screenHeight-height)/2)
  19. }
  20. });
  21. });
Next is the icons. This is simply letting it know the name of the png files you are using. Make two of them. One will be 16x16 and the other will be 128x128. Keep manifest version and chrome version as is unless you need a newer version of chrome. Manifest needs to be 2 to use the main.js example. Name is as self explanatory as possible.

Offline enabled doesn't need to be there if you are pointing to a page on your server, but if you are submitting the whole thing to the app store to be stored on their servers, then you do this so that the game will download to their computer and they won't have to connect online to play the game unless it does connection tests etc.

Permissions has a long list on their website, but I used "storage" for the ability to save in the future.

Finally version is your current version and should be updated each and every time.

No comments:

Post a Comment