I have to implement Invite and Earn functionality in my Android application.
What I have to do is : User can share the link to anyone on social media, On receiving the link, another user can click the link to get the application installed using that link.
After the user installs the app using that link, the sender or the invitee can be rewarded. How this can be possible ?
So far, I go through the Firebase's Dynamic Link concepts and found some demo. But, still confused in it.
Can you please guide me what another stuffs I have to gone through to achieve such thing ?
Is it possible in react-native. If not then How can I achieve that in Android ?
Thanks
You can Integrate Refer & earn in your react native application using react-native-branch
Just following the documentation of integrating branch.io in your react-native application and you will be good to go.
Documentation for react-native-branch
Here is also a github example for your reference Example
Since you have already gone through firebase
, therefore it would be easy for you to use the procedure based on the same.
Here's the roadmap for getting started
android/app/build.gradle
and MainApplication.java
to add the firebase dynamic linksSendInvitation Component
import firebase from 'react-native-firebase';
const title = 'Demo Firebase Invites'
const message = 'You have been invite to join the xxxxx app'
const invitation = new firebase.invites.Invitation(title, message);
invitation.setDeepLink(// Your App's Configured deep link)
invitation.setCustomImage(// Image Uri)
invitation.setCallToActionText(// Set the text on the invitation button on the email)
// ... On some button click
sendInvitation = async () => {
const invitationIds = await firebase.invites().sendInvitation(invitation)
// Invitation Id's can be used to track additional analytics as you see fit.
}
Handle Receive Invitation
Either use getInitialInvitation method or listen for invitations using the onInvitation listener.
At the root of your app you can add
import firebase from 'react-native-firebase';
firebase.invites()
.getInitialInvitation()
.then((invitation) => {
if (invitation) {
// app opened from an Invitation
// Set the rewards points here and update data in your firebase
} else {
// app NOT opened from an invitation
// No rewards for this user
}
});
The invitation contains the following objects which will help you with the queries on updating the sender reward points.
deepLink: string
invitationId: string
You can route to specific page using the deep link, and also get custom data passed from the invitee such as a random userId
to create the user on the firebase.
Use invitationId
to query other stuff.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With