Browse Source

高优先级的Android通知推送

luoyangwei 1 year ago
parent
commit
923e8624c3
2 changed files with 4 additions and 3 deletions
  1. 2 1
      server/fcm.go
  2. 2 2
      server/fcm_test.go

+ 2 - 1
server/fcm.go

@@ -187,7 +187,8 @@ func (f *FirebaseMessageServer) queueRun(ctx context.Context) {
 			},
 			Android: &messaging.AndroidConfig{
 				Notification: &messaging.AndroidNotification{
-					Sound: "default",
+					Sound:    "default",
+					Priority: messaging.PriorityHigh,
 				},
 			},
 			APNS: &messaging.APNSConfig{

+ 2 - 2
server/fcm_test.go

@@ -12,9 +12,9 @@ import (
 
 func TestFirebaseMessageServer_Send(t *testing.T) {
 	ctx := context.Background()
-	conf := &firebase.Config{ServiceAccountID: firebaseServiceAccountID}
+	conf := &firebase.Config{ServiceAccountID: iosFirebaseServiceAccountID}
 	app, err := firebase.NewApp(ctx, conf,
-		option.WithCredentialsJSON([]byte(firebaseCredentials)))
+		option.WithCredentialsJSON([]byte(iosFirebaseCredentials)))
 	if err != nil {
 		log.Fatalln(err)
 	}