React-native : Implementing Reward Referral (Invite and Earn)
Asked Answered
K

3

9

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

Kulun answered 11/9, 2018 at 7:58 Comment(0)
R
3

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

Rationale answered 13/9, 2018 at 10:47 Comment(6)
There are too lengthy process.Kulun
but i don't think what you are trying to achieve is a simple task. You have to take care of both appstore for ios and playstore for android to accomplish it.Rationale
you are correct, I have already gone through it. Will you tell me about Android only ?Kulun
Just try to follow steps for android only. Its not a big bang theory give it a try your app will be fine with it. I will post again if i find better solution then this in react native for you.Rationale
blog.reactnativecoach.com/… . See this if it helps.Rationale
How can I do it without using react-native-branch and only using Firebase Dynamic LinksForehead
J
3

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

Flow map

Set Up

  • Follow the Initial Setup Guide to configure adding the project to Firebase
  • Configure the android/app/build.gradle and MainApplication.java to add the firebase dynamic links
  • Configure the Firebase invites package
  • If you haven't configured deep link , take a look at this tutorial

Usage

SendInvitation 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.

Jamal answered 13/9, 2018 at 16:30 Comment(1)
Firebase Invites is deprecated. You can create cross-platform invitation links that survive app installation using Firebase Dynamic Links. Please see Migration Guide for more details.Grubb
A
0

For implementing this feature developers need to learn App links. And For implementing this you can use react-native-deep-linking.
I am giving you a little overview, You need to add some XML in the manifest file for android according to your needs and you will handle it using linking.

Attis answered 9/3, 2022 at 20:40 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.