Spaces:
Running on Zero
Running on Zero
File size: 5,408 Bytes
38bd54a 66a1a95 38bd54a | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 | # HearthNet Android Deployment Guide
## Quick Start: PWA (Progressive Web App) - RECOMMENDED โญ
**Status**: โ
Ready to use now - no APK build needed!
### Install HearthNet on Android (ANY device, no installation required):
1. **Start the HearthNet server** on your computer:
```bash
cd c:\Users\Chris4K\Projekte\HearthNet
python app.py
```
2. **Find your computer's IP address**:
```powershell
ipconfig
# Look for "IPv4 Address" under your network (e.g., 192.168.1.100)
```
3. **On your Android device**, open any browser (Chrome, Firefox, Edge, Samsung Internet):
- Go to: `http://YOUR_COMPUTER_IP:7860`
- Example: `http://192.168.1.100:7860`
4. **Install as app** (browser-specific):
- **Chrome/Edge**: Menu โ "Install app" or "Add to home screen"
- **Firefox**: Menu โ "Install"
- **Samsung Internet**: Menu โ "Add to home screen"
5. **Done!** ๐ HearthNet is now on your home screen with:
- Full offline support (Service Worker caching)
- Native app appearance (standalone mode)
- All features available
---
## Alternative: Native APK Build (Advanced)
### Why PWA is better:
- โ
Works instantly - no build needed
- โ
Updates automatically
- โ
Works on Chrome, Firefox, Edge, Samsung Internet
- โ
Smaller downloads (only web assets)
- โ
No app store needed
### APK Build Status:
- โ ๏ธ Requires complex local setup: Java 17 JDK, Gradle, Android SDK, cmdline-tools
- โ ๏ธ Build time: 5-15 minutes
- โ ๏ธ APK size: ~80-100 MB
- โ
One-time setup, then works offline completely
### If you want native APK anyway:
**Option A: Android Studio GUI (Recommended)**
1. Install [Android Studio](https://developer.android.com/studio)
2. File โ Open โ `c:\Users\Chris4K\Projekte\HearthNet\build\android\HearthNetApp`
3. Build โ Build Bundle(s) / APK(s) โ Build APK(s)
4. Find APK in: `platforms/android/app/build/outputs/apk/debug/app-debug.apk`
5. Install on device: `adb install -r app-debug.apk`
**Option B: Docker (Container-based)**
1. Install [Docker Desktop](https://www.docker.com/products/docker-desktop)
2. Run build container:
```bash
cd c:\Users\Chris4K\Projekte\HearthNet\build\android
docker build -f Dockerfile.build -t hearthnet-builder .
docker run --rm -v $(pwd)\HearthNetApp:/project hearthnet-builder
```
**Option C: Manual CLI Build**
1. Install Java 17 JDK, Gradle, Android SDK cmdline-tools
2. Set `ANDROID_HOME` environment variable
3. Run: `npx cordova build android --release`
4. APK appears in: `platforms/android/app/build/outputs/apk/`
---
## Testing Checklist
### PWA Testing (5 minutes):
- [ ] Server running: `python app.py`
- [ ] Browser opens: `http://YOUR_IP:7860`
- [ ] Install option appears in menu
- [ ] App icon on home screen
- [ ] Offline mode works (disable WiFi, app still loads)
- [ ] Chat/Ask/Mesh features functional
### APK Testing (if building):
- [ ] APK file generated (~80 MB)
- [ ] Device has USB Debugging enabled
- [ ] ADB recognizes device: `adb devices`
- [ ] Install: `adb install -r app-debug.apk`
- [ ] Tap launcher icon to open
- [ ] Enter server IP and connect
- [ ] Same features work as PWA
---
## Features Available
Both PWA and APK include:
- โ
Service Worker offline caching
- โ
Local-first P2P mesh network
- โ
Chat interface
- โ
Ask (LLM) interface
- โ
Mesh network topology view
- โ
Landing page with server connection
- โ
Persistent storage (localStorage)
- โ
Background sync placeholder
---
## Troubleshooting
### "Cannot connect to server"
- Check computer is on same WiFi as Android device
- Verify server running: `python app.py`
- Try ping: `ping 192.168.1.100` from Android (some WiFis block)
- Check firewall isn't blocking port 7860
### PWA not installing
- Use Chrome/Edge/Firefox (Samsung Internet also works)
- Tap menu icon (โฎ or three dots)
- Look for "Install" or "Add to Home Screen"
- Not all browsers show this option
### APK won't install
- Enable developer mode: Settings โ About Phone โ tap Build# 7 times
- Enable USB Debugging: Settings โ Developer Options โ USB Debugging
- Try: `adb install -r app-debug.apk` (includes -r flag to replace)
### Build errors
- Run: `npx cordova clean` before rebuilding
- Remove: `platforms/android` folder and re-add platform
- Check Java: `java -version` returns 17+
- Check Android SDK: `android list targets` shows API 31+
---
## Architecture
```
User Browser/App
โ
PWA/APK
โ
Cordova Wrapper (APK only)
โ
FastAPI Backend (http://localhost:7860)
โ
HearthNet Mesh
โ
P2P Network
```
---
## Next Steps
1. **Try PWA first** (5 minutes):
```bash
python app.py
# Then open http://YOUR_IP:7860 on Android
```
2. **If you need native APK**:
- Use Android Studio GUI (easiest)
- Or follow Docker instructions
- Or follow manual CLI instructions
3. **Deploy to Play Store** (future):
- Sign APK with keystore
- Create Google Play account
- Upload and publish
---
## Documentation Files
- [PWA Implementation](../modules/M08-ui.md) - Full web app details
- [Cordova Build Guide](../../build/android/CORDOVA_BUILD_GUIDE.md) - Detailed native build
- [APK Setup](../../build/android/SETUP_COMPLETE.md) - Project status
- [Build Paths](../../build/android/BUILD_PATHS.md) - Decision guide
---
**Recommended**: Start with PWA - it's production-ready now! ๐
|