パッケージ、リポジトリ、アプリカテゴリを検索

パッケージ詳細v0.0.4

plain_notification_token

プラットフォーム経由でプッシュ通知トークンを取得する (iOS 用の APNs / Android 用の Firebase Cloud Messaging)

AndroidiOS
30日間ダウンロード
70
いいね数
41
Pub ポイント
130

パッケージをインストール

flutter pub add plain_notification_token

パッケージ概要

公開情報に基づく選定ガイドです。参考としてご利用ください。

iOS用のAPNsとAndroid用のFirebase Cloud Messagingを使用して、プッシュ通知トークンを取得する軽量なFlutterパッケージです。下位実装を抽象化しており、開発者が通知を送信するためのデバイストークンを簡単に取得できるようにしています。シンプルさと信頼性を重視し、複雑な設定なしにプラットフォーム間で一貫したトークンアクセスを保証します。プッシュ通知機能が必要なアプリへのシームレスな統合が可能です。

用途

  • プッシュ通知のデバイストークンを取得中
  • Firebase Cloud Messaging との統合
  • iOS で APNs トークンを設定する
  • クロスプラットフォーム通知サポートを有効にする
  • メッセージアプリでのトークン取得の簡素化

主な機能

  • プラットフォーム固有のトークン取得
  • 最小限のボイラープレート
  • Android および iOS をサポートしています
  • FCM および APNs との簡単な統合
  • 軽量で依存関係なし

適している対象

  • プッシュ通知を必要とするアプリ
  • FCM や APNs を使用する開発者
  • シンプルさを最優先とするプロジェクト
  • クロスプラットフォームモバイルアプリ
  • デバイストークンを管理するバックエンドサービス

注意事項

  • FCM や APNs の適切な設定が必要です
  • トークンの再取得を自動で処理しない
  • ネットワーク問題に対する組み込みのエラー処理なし
  • トークン取得のみに制限
  • 実際のメッセージ送信に外部サービスに依存しています

元の README

関連するソースリポジトリの README 原文のスナップショットです。最新の内容はリポジトリをご覧ください。

plain_notification_token

Get your push notification token via platform way (APNs for iOS / Firebase Clound Messaging for Android)

Getting Started

Android Integration

To integrate your plugin into the Android part of your app, setup Firebase:

  1. Using the Firebase Console add an Android app to your project: Follow the assistant, download the generated google-services.json file and place it inside android/app.
  2. Modify the 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.)

iOS Integration

To integrate your plugin into the iOS part of your app, follow these steps:

  1. Generate the certificates from Apple developer center for receiving push notifications. (Please see this article if you want the tutorial.)
  2. Enable Push Notification in Capabilities tab in Xcode opening your ios/Runner.xcworkspace.

Enabling Push Notification switch

Dart/Flutter Integration

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).

カテゴリー

依存関係

依存関係一覧 1 件

ソースリポジトリ

このパッケージを使用しているプロジェクト