React native LINE
iOS and Android Native wrapper for Line's MobileSDK.
Requirements
- React native
0.48.+
. - LineSDK iOS
5.0.0
and Android4.0.8
.
Installation
First, install the npm package and link it to your Android and iOS projects with react-native link.
npm install react-native-line-sdk react-native link react-native-line-sdk
iOS Setup
Follow all the configuration steps in Line's iOS integration guide
Android Setup
- Follow all the configuration steps in Line's Android integration guide
- Add the string
line_channel_id
to your strings file with the the channel id that you have on your line console.
Your channel id here
- Download the line Android SDK here and save it on a new folder named
libs
under yourapp
folder on your android project. - Add the following to your app's build.gradle:
repositories { flatDir { dirs 'libs' }}
Usage
First, require the LineLogin
module:
Then, you can start using all the functions that are available:
-
login = () => Promise<{Profile, AccessToken}>
: Starts the login flow of Line's SDK (Opens the apps if it's installed and defaults to the browser otherwise.)` -
loginWithPermissions = (permissions) => Promise<{Profile, AccessToken}>
: iOS ONLY Works as thelogin
function but you can provide custom permissions settings. -
currentAccessToken = () => Promise<AccessToken>
: Returns the current access token for the currently logged in user. -
getUserProfile = () => Promise<Profile>
: Returns the profile of the currently logged in user. -
logout = () => Promise<Void>
: Logs out the currently logged in user.
Example:
LineLogin
Return values
The following objects are returned on the methods described above:
- Profile:
- AccessToken:
Example
To see more of react-native-line-sdk
in action you can check out the source in the example
folder.
Authors
License
react-native-line-sdk
is available under the MIT license. See the LICENCE file for more info.