Setup & Authentication

With social.plus UIKit 2.3, we have introduced a new way to Authentication process. Just follow the guide below.

Adding required permissions

Your app may require the following permissions to work properly;

  1. Camera access

  2. Microphone access

  3. Photo library usage access

Before submitting your application to the store, please make sure the following permissions are already granted. Here are the steps to ask for permission.

Locate the info.plist file and add:

  1. NSCameraUsageDescription

  2. NSMicrophoneUsageDescription

  3. NSPhotoLibraryUsageDescription

Setup API key

AmityUIKit requires an API key. You need a valid API key to begin using the UIKit. Please find your account API key in the social.plus Console.

After logging in Console:

  1. Click Settings to expand the menu.

  2. Select Security.

  3. On the Security page, you can find the API key in the Keys section.

API key in Security page

Certainly! The provided code snippet demonstrates how to set up and authenticate using the social.plus UIKit for Flutter. Let's break it down into a step-by-step guide:

Step 1: Initialize social.plus SDK

First, you need to initialize the social.plus SDK in your main function. This is crucial for setting up the SDK before your Flutter app starts running.

  • WidgetsFlutterBinding.ensureInitialized(): Ensures that Flutter bindings are initialized.

  • AmitySLEUIKit().initUIKit("YOUR_API_KEY", "REGION"): Initializes the social.plus UIKit with your API key and region. Replace "YOUR_API_KEY" and "REGION" with the actual values.

Step 2: Wrap MaterialApp with AmitySLEProvider

In your main app widget (here, MyApp), wrap the MaterialApp with AmitySLEProvider. This provider is necessary for the Amity UIKit to function properly throughout your app.

Step 3: Implement Authentication

In your InitialWidget class, implement a button to handle the login process with social.plus.

  • Replace "USER_IDENTIFIER" with the identifier of the user who is logging in.

Step 4: Navigating to UIKit Screens

The code provides examples of how to navigate to various screens provided by the social.plus UIKit, like channel lists, chat rooms, and global feeds.

Final Step: Running Your App

Once these steps are implemented, you can run your Flutter app. The social.plus UIKit should be integrated and functioning according to the setup in your main.dart.

Remember to replace placeholders like "YOUR_API_KEY", "REGION", and "USER_IDENTIFIER" with actual values specific to your social.plus UIKit setup.

Register the device for push notifications

Registering your app for push notifications will require a device token as a parameter.

social.plus's UIKit does not manage:

  • User-facing requests for push notifications and authorizations

  • The creation and refreshing of push notification tokens

It's up to your app to take those steps and pass the device token.

Unregister

If your user logs out, you should explicitly unregister the user from the SDK as well, to prevent the current device from receiving any unnecessary or restricted data.

Unregistering a device is a synchronous operation. Once theunregisterDevice method is called, the SDK disconnects from the server and wipes out user session.

Example main.dart

Last updated

Was this helpful?