wails/v3/pkg/application/systemtray_android.go
Lea Anthony 4d8ec29feb feat: Add Android support for Wails v3
This commit adds comprehensive Android support for Wails v3, enabling
Go applications to run as native Android apps with WebView-based UI.

Key features:
- Android-specific application implementation with JNI bridge
- WebView integration via WebViewAssetLoader for serving assets
- JavaScript runtime injection and execution via JNI callbacks
- Binding call support with async result callbacks
- Event system support for Android platform
- Full example Android app with Gradle build system

Technical details:
- Uses CGO with Android NDK for cross-compilation
- Implements JNI callbacks for Go <-> Java communication
- Supports both ARM64 and x86_64 architectures
- WebView debugging support via Chrome DevTools Protocol
- Handles empty response body case in binding calls to prevent panic

Files added:
- v3/pkg/application/*_android.go - Android platform implementations
- v3/pkg/events/events_android.go - Android event definitions
- v3/internal/*/\*_android.go - Android-specific internal packages
- v3/examples/android/ - Complete example Android application
- v3/ANDROID_ARCHITECTURE.md - Architecture documentation

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-28 21:06:59 +11:00

102 lines
2.1 KiB
Go

//go:build android
package application
// Android doesn't have system tray support
// These are placeholder implementations
func (t *SystemTray) update() {}
func (t *SystemTray) setMenu(menu *Menu) {
// Android doesn't have system tray
}
func (t *SystemTray) close() {
// Android doesn't have system tray
}
func (t *SystemTray) attachWindow(window *WebviewWindow) {
// Android doesn't have system tray
}
func (t *SystemTray) detachWindow(windowID uint) {
// Android doesn't have system tray
}
type androidSystemTray struct {
parent *SystemTray
}
func newSystemTrayImpl(s *SystemTray) systemTrayImpl {
return &androidSystemTray{
parent: s,
}
}
func (s *androidSystemTray) run() {
// Android doesn't have system tray
}
func (s *androidSystemTray) setLabel(_ string) {
// Android doesn't have system tray
}
func (s *androidSystemTray) setMenu(_ *Menu) {
// Android doesn't have system tray
}
func (s *androidSystemTray) setIcon(_ []byte) {
// Android doesn't have system tray
}
func (s *androidSystemTray) setDarkModeIcon(_ []byte) {
// Android doesn't have system tray
}
func (s *androidSystemTray) destroy() {
// Android doesn't have system tray
}
func (s *androidSystemTray) setIconPosition(_ IconPosition) {
// Android doesn't have system tray
}
func (s *androidSystemTray) positionWindow(_ Window, _ int) error {
return nil
}
func (s *androidSystemTray) detachWindowPositioning(_ uint) {
// Android doesn't have system tray
}
func (s *androidSystemTray) setTemplateIcon(_ []byte) {
// Android doesn't have system tray
}
func (s *androidSystemTray) openMenu() {
// Android doesn't have system tray
}
func (s *androidSystemTray) setTooltip(_ string) {
// Android doesn't have system tray
}
func (s *androidSystemTray) bounds() (*Rect, error) {
return nil, nil
}
func (s *androidSystemTray) getScreen() (*Screen, error) {
screens, err := getScreens()
if err != nil || len(screens) == 0 {
return nil, err
}
return screens[0], nil
}
func (s *androidSystemTray) Show() {
// Android doesn't have system tray
}
func (s *androidSystemTray) Hide() {
// Android doesn't have system tray
}