Skip to content

Commit f990686

Browse files
committed
feat: make animal sounds game installable on android mobile
1 parent 2dea8f7 commit f990686

File tree

4 files changed

+57
-1
lines changed

4 files changed

+57
-1
lines changed

_config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ description: Perspectives on science, technology, and engineering.
1717
# Build settings
1818
markdown: kramdown
1919

20-
include: [".well-known"]
20+
include: [".well-known", "manifest.json", "sw.js"]
2121

2222
plugins:
2323
- jekyll-sitemap

kids-animal-sounds-game.html

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
/>
99
<meta name="apple-mobile-web-app-capable" content="yes" />
1010
<meta name="mobile-web-app-capable" content="yes" />
11+
<meta name="theme-color" content="#667eea" />
12+
<link rel="manifest" href="/manifest.json" />
1113

1214
<title>Interactive Animal Sounds Game for Kids</title>
1315
<meta
@@ -513,6 +515,20 @@
513515
}
514516

515517
initializeAnimals();
518+
519+
// Register Service Worker for PWA functionality
520+
if ("serviceWorker" in navigator) {
521+
window.addEventListener("load", () => {
522+
navigator.serviceWorker
523+
.register("/sw.js")
524+
.then((registration) => {
525+
console.log("ServiceWorker registered:", registration.scope);
526+
})
527+
.catch((error) => {
528+
console.log("ServiceWorker registration failed:", error);
529+
});
530+
});
531+
}
516532
</script>
517533
</body>
518534
</html>

manifest.json

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"name": "Animal Sounds Game for Kids",
3+
"short_name": "Animal Sounds",
4+
"description": "A fun, interactive animal sounds game for toddlers and young children. Tap to hear real animal sounds!",
5+
"start_url": "/kids-animal-sounds-game.html",
6+
"display": "standalone",
7+
"background_color": "#667eea",
8+
"theme_color": "#667eea",
9+
"orientation": "any",
10+
"icons": [
11+
{
12+
"src": "/images/kids-animal-sounds-game/kids-animal-sounds-game.png",
13+
"sizes": "1200x630",
14+
"type": "image/png",
15+
"purpose": "any"
16+
},
17+
{
18+
"src": "/images/kids-animal-sounds-game/kids-animal-sounds-game.png",
19+
"sizes": "512x512",
20+
"type": "image/png",
21+
"purpose": "maskable"
22+
}
23+
],
24+
"categories": ["games", "education", "kids"],
25+
"scope": "/",
26+
"prefer_related_applications": false
27+
}

sw.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Minimal Service Worker for Animal Sounds Game PWA
2+
// This enables the app to be installed on Android home screen
3+
// No offline caching - always fetches from network
4+
5+
self.addEventListener("install", () => {
6+
// Activate immediately
7+
self.skipWaiting();
8+
});
9+
10+
self.addEventListener("activate", () => {
11+
// Take control immediately
12+
return self.clients.claim();
13+
});

0 commit comments

Comments
 (0)