castled-react-native-sdk v1.28.0
Castled React Native SDK
:star: Introduction
Castled React Native SDK enables React Native mobile applications running on iOS and Android devices to receive messages send from the Castled Customer Engagement Platform. It is implemented as a Turbo Native Module with backward compatability. Turbo Native Modules are the next iteration on React Native Modules for apps based on the New Architecture. This SDK facilitates:
- Receiving push notifications.
- Displaying in-app messages and app inbox notifications.
- Updating user profiles.
- Collecting user events.
The following steps will guide app developers on how to seamlessly integrate the SDK into their mobile applications.
:roller_coaster: Getting Started
Installing SDK
Add the library to your project
npm install castled-react-native-sdkNative Setup
Android
Update
build.gradleInclude
google-servicesplugin dependency in top-level gradle file// Top-level android/build.gradle file where you can add configuration options common to all sub-projects/modules. buildscript { repositories { // Add google maven repository google() } ... dependencies { ... classpath("com.google.gms:google-services:<plugin-version>") } }Apply
google-servicesplugin to app gradle fileapply plugin: "com.google.gms.google-services"Add required permissions
By default
AndroidManifest.xmlof the SDK includes the following permission requests. No developer action is required here.<!-- Castled SDK needs this permission to sync user token and campaign events --> <uses-permission android:name="android.permission.INTERNET"/> <!-- Castled SDK will use this permission to decide when to make network calls --> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
iOS
Pod Installation
Navigate to ios directory of your app project and run
pod install
Initializing SDK
Next step is to initialize the SDK. Initialization is typically done in App.js.
import * as React from 'react';
// Importing SDK modules required for initialization
import {
CastledNotifications,
CastledConfigs,
CastledLocation,
} from 'castled-react-native-sdk';
import Header from './Header';
export default function App() {
...
React.useEffect(() => {
// Set config
const configs = new CastledConfigs();
configs.appId = '<app-id>';
configs.location = CastledLocation.US;
// Initialize SDK
CastledNotifications.initialize(configs);
}, []);
...
return (
<>
...
</>
);
}api-keyis a unique key associated with your Castled account. It can be found in the Castled dashboard at Settings > Api Keys.locationis the region where you have your Castled account.
:books: Documentation
More details about the SDK integration can be found at https://docs.castled.io/developer-resources/sdk-integration/reactnative/getting-started
Contributing
See the contributing guide to learn how to contribute to the repository and the development workflow.
License
MIT
Made with create-react-native-library
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago