HTML and CSS Reference
In-Depth Information
clipboardWrite
,
geolocation
,
notifications
, and
unlimitedStorage
. With the exception of
background, these should be self-explanatory.
The background permission is something special that enables you to continue to run code in the background
even if the app isn't active or hasn't even been launched. This might be useful for multiplayer games to notify
users of actions occurring in the game world even if the user isn't actively playing the game. You can read
more in-depth documentation on the background feature at
https://developers.google.com/chrome/apps/docs/
Now copy the icon
invasion_128.png
into the same directory as the manifest file and you're done!
You can test out the hosted app by loading it as an unpackaged extension. Click the Chrome Wrench menu;
then select the Tools menu and click Extensions.
If you're not already in Developer Mode, click the Developer Mode check box in the top right of the page.
Next, click the Load Unpacked Extension button and find the folder you just created. Click Select. (You are
selecting a folder, not a file, so just single-click the folder and click Select.)
If everything went according to plan, you should see the
Alien Invasion
extension at the top of the extensions
page with its icon, as shown in
Figure 27-1
.
Figure 27-1:
The
Alien Invasion
extension.
If you create a new tab, you should see the
Alien Invasion
icon in your app screen and you can jump right to
the game by clicking it.
Creating a Packaged App
The difference between a hosted app and a packaged app is simply that the packaged app includes all the files
necessary to run the game in the app directory and points to a local file rather than a
web_url
.
To create a packaged app from
Alien Invasion
, you need to create a new directory and copy all the files for
Alien Invasion
inside of it.
Next, create a
manifest.json
file, as shown in
Listing 27-2
,
and copy the same
invasion_128.png
icon
into the directory along with an
invasion_16.png
that serves as the favicon for the app.
Listing 27-2:
manifest.json for a packaged app
{
"name": "Alien Invasion Packaged",
"description": "Save the world, you know the drill...",