redlink_flutter_sdk 1.0.0-dev.1

Flutter Android iOS

Flutter plugin for Redlink

Redlink for Flutter #

A Flutter plugin to use the Redlink Push Notifications.

Getting started #

To use this plugin, add redlink_flutter_sdk as a dependency in your pubspec.yaml file.

Example project #

Check out the example directory for a sample app and see how to integrate Redlink Push Notifications.

Android Integration #

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

Firebase platform integration

Redlink push is based on firebase platform. To configure it on Android check the documentation

Gradle setup

Add required tokens to *.xml resources, obtained from the Redlink dashboard.

<string name="redlink_app_id"></string>
<string name="redlink_token"></string>
<string name="redlink_secret"></string>
<string name="redlink_events_token"></string>

Add required firebase sender id, obtained from the Firebase dashboard (Settings -> Cloud Messaging -> Sender ID)

<string name="fcm_sender_id"></string>

SDK initializes automatically, there are no other actions required.

iOS Integration #

Required:

  • Valid iOS Push Token
  • Physical iOS device (Push services doesn't work in Simulator)
  • Redlink account with AppId, Token, Secret and Events Token
  • Application with deployment target equal or above iOS 10.0

Add RedlinkConfig.plist

  • Select in Xcode File -> New -> File
  • Under Resource section select Property List
  • Fill SaveAs with name RedlinkConfig.plist and select Targets (should be both, project_name and project_nameNotificationServiceExtension)
  • Right click on added RedlinkConfig.plist and select Open As -> Source Code
  • Add following code instead of original one
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>AppId</key>
    <string>your_application_id</string>
    <key>Token</key>
    <string>your_application_token</string>
    <key>Secret</key>
    <string>your_application_secret</string>
    <key>EventsToken</key>
    <string>your_application_events_token</string>
</dict>
</plist>
  • Replace your_application_id, your_application_token, your_application_secret and your_application_events_token with variables obtained from Redlink dashboard.

Notification Service Extension

If you want your app to receive some extra media content like images you need to incorporate Notification Service Extension target to your project. To do so simply follow these steps:

  • In Xcode select File -> New -> Target
  • Select Notification Service Extension and press Next
  • Fill in Product Name with project_nameNotificationServiceExtension (change project_name to name of your project)
  • Select Swift under Language section (Even if your project is written in Obj-C)
  • Skip Activate scheme alert using Cancel
  • Remove a class body generated by Xcode, import Redlink framework and use RedlinkNotificationServiceExtension as a superClass. Your extension should now look like this:
import Redlink

class project_nameNotificationServiceExtension: RedlinkNotificationServiceExtension {
    // Do nothing, Redlink will do all the job
} 

Dart/Flutter Integration #

From your Dart code, you need to import the plugin and instantiate it:

import 'package:redlink_flutter_sdk/redlink_messaging.dart';

final RedlinkMessaging _redlinkMessaging = RedlinkMessaging();

Push notifications

Register onMessage callback via _redlinkMessaging.configure() to listen for incoming messages. This will bring up a permissions dialog for the user to confirm on iOS. It's a no-op on Android.

   _redlinkMessaging.configure(
         onMessage: (Map<String, dynamic> message) async {
           print("onMessage: $message");
         },
       );

Note: configure should be called the very first moment your application should start receiving notifications as early as possible.

User Identification

In order to update information about user use _redlinkMessaging.setUser method. You can change each of the following data fields:

  • email String
  • phone String
  • firstName String
  • lastName String

Validation:

  • email requires valid email format
  • email, companyName, firstName, lastName can be up to 64 length characters
0
likes
70
pub points
0%
popularity

Publisher

flutter.redlink.pl

Flutter plugin for Redlink

Homepage

Documentation

API reference

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on redlink_flutter_sdk