plain_notification_token
플랫폼 방식을 통해 푸시 알림 토큰을 가져옵니다 (iOS용 APNs / Android용 Firebase Cloud Messaging)
플랫폼 방식을 통해 푸시 알림 토큰을 가져옵니다 (iOS용 APNs / Android용 Firebase Cloud Messaging)
{"sdk":"flutter"}^3.1.0{"sdk":"flutter"}아래는 영문 원문 스냅샷입니다. 최신 내용은 GitHub에서 확인하세요.
Get your push notification token via platform way (APNs for iOS / Firebase Clound Messaging for Android)
To integrate your plugin into the Android part of your app, setup Firebase:
google-services.json file and place it inside android/app.android/build.gradle file and the android/app/build.gradle file to add the Google services plugin as described by the Firebase assistant.(Please see this tutorial if you want.)
To integrate your plugin into the iOS part of your app, follow these steps:
Push Notification in Capabilities tab in Xcode opening your ios/Runner.xcworkspace.Enabling Push Notification switch
From your Dart code, you need to import the plugin and instantiate it:
import 'package:plain_notification_token/plain_notification_token.dart';
final plainNotificationToken = PlainNotificationToken();
To get token, call getToken():
// (iOS Only) Need requesting permission of Push Notification.
if (Platform.isIOS) {
plainNotificationToken.requestPermission();
// If you want to wait until Permission dialog close,
// you need wait changing setting registered.
await plainNotificationToken.onIosSettingsRegistered.first;
}
final String token = await plainNotificationToken.getToken();
... and use token on your server!!
Token is Base64 stringified APNs token (in iOS) / Firebase Cloud Messaging (FCM) string token (in Android).