getsocial-react-native-sdk-mx
v7.12.6
Published
React Native wrapper for GetSocial iOS and Android SDK with support for running on iOS Simulator on Macs with M1/M2 chips that require arm64 architecture
Downloads
20
Maintainers
Readme
GetSocial React Native SDK
Learn more about the products we build at getsocial.im.
This particular package provides support for running the GetSocial SDK on iOS Simulator on Macs with M1/M2 chips that require arm64 architecture. Unfortunately, at this moment, using this package is not compatible with the GetSocial SDK UI features.
If your app requires using GetSocial SDK UI features, we suggest using the getsocial-react-native-sdk
package instead and test on physical devices instead of using the iOS Simulator.
Getting started
Prerequisities
To start using GetSocial, you have to create a free account and login to GetSocial Dashboard. Dashboard provides a web interface to manage all GetSocial services.
Install React Native package
- Run
npm install getsocial-react-native-sdk-mx --save
in your app's root folder.
Configure GetSocial SDK
Android
To start using GetSocial, you have to add and configure GetSocial Gradle Plugin to your Android project. Plugin adds all GetSocial dependencies to the project and configures AndroidManifest.xml
.
To add GetSocial Gradle plugin:
Add repository and classpath dependency for the plugin in your top-level
build.gradle
. This file is for the entire project so it will be used for global project configurations:buildscript { repositories { ... maven { url "https://plugins.gradle.org/m2/" } } dependencies { ... classpath "im.getsocial:plugin-v7:[1,2)" } }
In the Android application project
build.gradle
(this file is the module build file, so it will be used for specific module level configs) applyim.getsocial
plugin aftercom.android.application
plugin:apply plugin: 'com.android.application' apply plugin: 'im.getsocial' // should be applied after com.android.application plugin
In the same
build.gradle
configure GetSocial plugin with GetSocial App id:getsocial { appId "put-your-getsocial-app-id-here" ... }
Check the GetSocial Gradle plugin reference for the full list of available configurations.
iOS
To start using GetSocial, you have to add and configure GetSocial installer script to your Xcode project. The script adds GetSocial frameworks to the project and configures app entitlements, plist files, and Xcode project settings.
To add GetSocial installer script:
Run
pod install
to update dependencies.In your Xcode project go to Project Settings --> select target you want to modify --> Build Phases tab.
Create new Run Script phase with the content:
"$PROJECT_DIR/getsocial-sdk7.sh" --app-id="your-getsocial-app-id"
Move Run Script phase before the Compile Sources phase.
Build your project.
!!! tip "Project Backups"
GetSocial installer script creates a backup of your project.pbxproj
file every time it is executed. If something goes wrong, you can always roll back to the previous version.
!!! tip "Source Control Configuration"
We suggest adding .backup
files under .xcodeproj
to ignore list to keep your version control history clean.
Start Using GetSocial
SDK Initialization
GetSocial SDK is auto-initialized, just provide a GetSocial App Id in the Gradle plugin on Android, or as a parameter to the iOS Installer Script on iOS, and we will do the magic.
If you want to be notified about initialization complete, you can register a listener, which will be invoked when SDK gets initialized or invoked immediately if it is already initialized:
import {GetSocial} from 'getsocial-react-native-sdk-mx';
...
GetSocial.addOnInitializedListener(() => {
// GetSocial SDK is ready to use
});
Send your first invite
import {Invites} from 'getsocial-react-native-sdk-mx';
...
Invites.send(nil, "email", () => {
console.log('Invitation via email was sent');
}, () => {
console.log('Invitation via email was cancelled');
}, (error) => {
console.log('Failed to send invitation via email failed, error: ' + error.message);
});