chore: update example to use cross-platform API

This commit is contained in:
Chris Waldon 2020-06-21 21:54:07 -04:00
parent 1215aa671d
commit 32d429da19
No known key found for this signature in database
GPG Key ID: 35BBC7C073F5A5D3
1 changed files with 4 additions and 6 deletions

View File

@ -15,9 +15,9 @@ import (
"gioui.org/op"
"gioui.org/text"
"gioui.org/widget/material"
"git.sr.ht/~whereswaldon/niotify"
"gioui.org/font/gofont"
"git.sr.ht/~whereswaldon/niotify/android"
)
//go:generate javac -target 1.8 -source 1.8 -bootclasspath $ANDROID_HOME/platforms/android-29/android.jar ../android/NotificationHelper.java
@ -53,16 +53,14 @@ func loop(w *app.Window) error {
if first {
first = false
go func() {
channel, err := android.NewChannel(android.ImportanceMax, "CHANNEL", "hello", "description")
mgr, err := niotify.NewManager()
if err != nil {
log.Printf("channel creation failed: %v", err)
log.Printf("manager creation failed: %v", err)
}
log.Println(channel)
notif, err := channel.Send("hello!", "IS GIO OUT THERE?")
notif, err := mgr.CreateNotification("hello!", "IS GIO OUT THERE?")
if err != nil {
log.Printf("notification send failed: %v", err)
}
log.Println(notif)
time.Sleep(time.Second * 10)
if err := notif.Cancel(); err != nil {
log.Printf("failed cancelling: %v", err)