Android

Version:- 1.4.32

Add Dependency

Step 1: Add auth token

Add the following line of code in your YourProject/gradle.properties file.

authToken=jp_9lured1djkqj83p7vaqhes4img

Step 2: Add jitpack url

Add the following line of code in your project level build gradle, YourProject/build.gradle file.

allprojects {
   repositories {
       ...

       maven {
           url 'https://jitpack.io'
           credentials { username authToken }
       }
   }
}

Step 3: Add FLYY SDK dependency

Add the following line of code in your app level build gradle, YourProject/app/build.gradle file.

dependencies {

   api 'com.github.roid-software:flyy-sdk:1.4.32'
}

Here ends adding dependency related to Flyy SDK, sync and build your app before further integration.

Register Package Name

You can register the package name in Flyy Dashboard.
Go to Settings -> Connect SDK

Set Package Name

You can set your package name using this method. Kindly make sure the package name should be the same as your package name given while connecting the SDK in the dashboard.

Flyy.setPackageName("<package_name_same_as_registered_in_flyy_dashboard>");

Get Partner Id

You can find the partner ID in Flyy Dashboard.
Go to Settings -> SDK Keys

SDK Initialization

Initialize sdk in your application or main entry point of the app.

//For Production
Flyy.init(getApplicationContext(), "{partner_id}", Flyy.PRODUCTION);

//For Staging
Flyy.init(getApplicationContext(), "{partner_id}", Flyy.STAGE);

Set Theme Colors

Please note this is a mandatory step to set theme colors and should be done immediately after initialization of Flyy SDK.

//Parameters to be passed are colorPrimary and colorPrimaryDark
Flyy.setThemeColor("#FF5733", "#842C19");

Set unique User ID with and without Segment ID

To complete the initialization process, you must call either setNewUser() or setUser().

  • setNewUser() should be called only if it’s a new user.
  • setUser() should be called if the user is an existing user. Call setUser() every time the app opens to make the sdk work.
//FOR SET USER

//set user id
Flyy.setUser("unique_id");
//For SET NEW USER

//set new user id
Flyy.setNewUser("unique_id");
Note : unique_user_id can be any string which will be shown in reports, 
which must be unique and must not be changed for a User.

Set Name

This will be shown in the screens wherever username is displayed

Flyy.setUsername("<user_name>");

Offers Screen

To open offers a screen for users with or without segment id.

Flyy.navigateToOffersActivity(context);
                OR
Flyy.navigateToOffersActivity(context, “segment_id”);

Rewards Screen

To open rewards screen for users.

Flyy.navigateToRewardsActivity(context);

Wallet Screen

To open wallet screen for user.

Flyy.navigateToWalletActivity(context);

Handle Notification

If your app already implements FirebaseMessagingService, handle the notification in the following way. Below is the sample code you need to put in your onMessageReceived() to handle Flyy Notifications.

Map<String, String> data = remoteMessage.getData();
if(data.containsKey("notification_source")
       && data.get("notification_source").equalsIgnoreCase("flyy_sdk")) {
   FlyyNotificationHandler.handleNotification(getApplicationContext(),     remoteMessage,null, null);
}

Release FAQ’s

Proguard Rules

If you are using proguard, please add these following rules to your proguard-rules.pro before you release the app.

#Retrofit does reflection on generic parameters. InnerClasses is required to use Signatureand
# EnclosingMethod is required to use InnerClasses.
-keepattributes Signature, InnerClasses, EnclosingMethod
# Retrofit does reflection on method and parameter annotations.
-keepattributes RuntimeVisibleAnnotations, RuntimeVisibleParameterAnnotations
#Retain service method parameters when optimizing.
-keepclassmembers,allowshrinking,allowobfuscation interface * { @retrofit2.http.* <methods>;}
# Ignore annotation used for build tooling.
-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
# Ignore JSR 305 annotations for embedding nullability information.
-dontwarn javax.annotation.**
# Guarded by a NoClassDefFoundError try/catch and only used when on the classpath.
-dontwarn kotlin.Unit
# Top-level functions that can only be used by Kotlin.
-dontwarn retrofit2.KotlinExtensions
-dontwarn retrofit2.KotlinExtensions$*
# With R8 full mode, it sees no subtypes of Retrofit interfaces since they arecreated withaProxy
# and replaces all potential values with null. Explicitly keeping the interfacesprevents this.
-if interface * { @retrofit2.http.* <methods>; }
-keep,allowobfuscation interface <1>-keep class retrofit2.** { *; }
-keep public class theflyy.com.flyy.** {*;}

Additional Screens

Gift Cards Screen

To open gift cards screen for user.

Flyy.navigateToGiftCardsActivity(context);

Referral History Screen

To open referral history screen for user.

Flyy.navigateToReferralHistoryActivity(context);

Quiz Screen

To open quiz screen for user.

Flyy.navigateToQuizActivity(context, 0);
//live quiz_id or 0

Quiz History Screen

To open quiz history screen for user.

Flyy.navigateToQuizHistoryActivity(context);

Quiz List Screen

To open quiz list screen for user.

Flyy.navigateToQuizListActivity(context);

Stamps Screen

To open quiz list screen for user.

Flyy.navigateToStampActivity(context);

Invite Detail Screen

To open the invite detail screen for user.

Flyy.navigateToInviteDetailActivity(this, 2);
//offer_id can be null

Invite And Earn Screen

To open the invite and earn screen for the user.

Flyy.navigateToInviteAndEarnActivity(this, 2);
//offer_id can be null

Custom Invite and Earn Screen

To open a custom invite and earn screen for the user.

Flyy.navigateToCustomInviteAndEanActivity(this, 2, “#ffffff”);
//offer_id can be null
//tool bar items default color will be black if color is not passed

Challenge Details Screen

To open the challenge details screen for the user.

Flyy.navigateToChallengeDetailActivity(this, 2);
//offer_id can be null

Bonanza Screen

To open a bonanza details screen for user.

Flyy.navigateToBonanzaActivity(this);

Raffle Screen

To open the raffle details screen for the user.

Flyy.navigateToRaffleDetailActivity(this, raffleId);

Additional Methods

SDK Initialization with referral callback

Initialize sdk in your application or main entry point of the app with referral callback as shown below.

//For Production
Flyy.init(getApplicationContext(), "{partner_id}", Flyy.PRODUCTION, new FlyyReferrerDataListener() {
   @Override
   public void onReferrerDataReceived(String referrerData) {
       // TODO do your work here
   }
});


//For Staging
Flyy.init(getApplicationContext(), "{partner_id}", Flyy.STAGE, new FlyyReferrerDataListener() {
   @Override
   public void onReferrerDataReceived(String referrerData) {
       // TODO do your work here
   }
});

Set User Token

To increase security for your users you can set unique user token in the following manner instead of setUser() method.

///without callback
Flyy.setUserToken("BSt4Y3A2"); //pass your user token

Set User Token along with Segment ID

To increase security for your users you can set unique user token along with segment id in the following manner instead of setUser() method.

//without callback
Flyy.setUserToken("BSt4Y3A2", "all_users");

Set New User Token

To increase security for your users you can set unique new user token for new registered users in the following manner instead of setNewUser() method

Flyy.setNewUserToken("QWt4Y3A2"); //pass your new user token

Set New User Token along with Segment ID

To increase security for your users you can set unique new user token for new registered users along with segment id in the following manner instead of setNewUser() method.

//without callback
Flyy.setNewUserToken("QWt4Y3A2", "all_users");

Set Bank Details

You can use the following method to set user redemption details, which takes following params,

  1. Account number - bank account number
  2. IFSC code
  3. Name
Flyy.setBankDetails("0000xxxxxxxxxx16", "BSxxxxxxx0", "Pooja");

Set UPI Details

You can use the following method to set user redemption details, which takes following params,

  1. UPI ID
Flyy.setUPI("[email protected]");

Send Events

Values can either be sent in the form of key and value or as a json object.

Flyy.sendEvent("profile_updated", "true");

                 //OR

Flyy.sendEvent("registration", <jsonObject>);

Set Referral Code

To set referral code, please call the following function

Flyy.setReferrerCode("sdfhyr6");

To Verify valid Referral Code

To verify if referral code is valid or not, please call the following function

Flyy.verifyReferralCode(this, "sdfhyr6", new FlyyVerifyReferralCode() {
   @Override
   public void isReferralCodeValid(boolean isValid, String referralCode) {
       if (isValid) {
           Log.d(TAG, "isReferralCodeValid: " + referralCode);
       }
   }
});

To show the notification popup

Use the below code to show a default Flyy notification popup. You can keep the notificaiton_id and campaign_id 0/-1 if you don't have one.

Flyy.showPopup(getApplicationContext(), notification_id, "title", "message", "big_image", "deeplink", campaign_id);

To show reward won popup

Use the below code to show the reward won popup.

Flyy.showRewardWonPopup(
   "title", "message", "deeplink", "buttonText", showConfetti);
//showConfetti is a boolean value

To show reward won scratch card popup

Use the below code to show the reward won scratch card popup.

Flyy.showRewardWonScratchPopup(
   "title", "message", showConfetti, "refNum");
//showConfetti is a boolean value

To get share data

Use the below code to get share data.

Flyy.getShareData(this, new FlyyReferralDataFetchedListener() {
   @Override
   public void onReferralDetailsFetched(FlyyReferralDetails referralDetails) {

   }

   @Override
   public void onFailure(String failureMessage) {

   }
});

To get referral count

Use the below code to get referral count.

Flyy.getReferralCount(this, new FlyyReferralCountFetchedListener() {
   @Override
   public void onReferralCountFetched(int referralsCount) {
     
   }

   @Override
   public void onFailure(String failureMessage) {

   }
});

To get scratch card count

Use the below code to get scratch card count.

Flyy.getScratchCardCount(this, new FlyyFetchScratchCardCountListener() {
   @Override
   public void onSuccess(FlyyScrachCardCount flyyScrachCardCount) {
     
   }

   @Override
   public void onFailure(String message) {

   }
});

To get previous leaderboard winner

Use the below code to get previous leaderboard winners.

Flyy.getPreviousLeaderboardWinners(this, new FlyyFetchLeaderboardDataListner() {
   @Override
   public void onSuccess(FlyyLeaderboardData flyyLeaderboardData) {
     
   }

   @Override
   public void onFailure(String message) {

   }
});

To get leaderboard participants

Use the below code to get leaderboard participants.

Flyy.getLeaderboardParticipants(this, new FlyyFetchLeaderboardDataListner() {
   @Override
   public void onSuccess(FlyyLeaderboardData flyyLeaderboardData) {
     
   }

   @Override
   public void onFailure(String message) {

   }
});

To get wallet balance

Use the below code to get wallet balance.

Flyy.getWalletBalance(this, "Cash",  new FlyyFetchWalletDataListener() {
   @Override
   public void onSuccess(FlyySpecificWalletData flyySpecificWalletData) {
     
   }

   @Override
   public void onFailure(String message) {

   }
});

To get referrer details

Use the below code to get referrer details.

Flyy.getReferrerDetails(this, new FlyyFetchReferrerDetailsListener() {
   @Override
   public void onSuccess(FlyyReferrerDetails flyyReferrerDetails) {
     
   }

   @Override
   public void onFailure(String message) {

   }
});

To get offers count

Use the below code to get offers count.

Flyy.getOffersCount(this, new FlyyFetchOffersCountListener() {
   @Override
   public void onSuccess(FlyyOffersCount flyyOffersCount) {
      
   }

   @Override
   public void onFailure(String message) {

   }
});

Advanced Implementation

Get SDK Closed Listener

To get flyy sdk closed listener

Flyy.getFlyySDKClosed(new FlyySDKClosedListener() {
   @Override
   public void onSDKClosed() {
       //do your work here
   }
});

Add User to a Segment

To add a user to a specific segment. If you are adding a user to an existing segment, you can pass null in segment_title. If the user segment is not present it will create a new one

Flyy.addUserToSegment(segment_title, segment_key);

To get Screen Visits data

Use the below code to get the following data:-

[“home_checkin_clicked”, “offer_card_clicked”, “game_card_clicked”, “quiz_card_clicked”, “stamp_campaign_card_clicked”, “leaderboard_card_clicked”, “checkin_card_clicked”, “challenges_card_clicked”, “raffle_card_clicked”, “transaction_screen_visited”, “detail_checkin_clicked”, “referrals_screen_visited”, “rewards_screen_visited”, “wallet_screen_visited”]

Flyy.trackUIEvents(new FlyyUIEventsListener() {
   @Override
   public void onEventDone(FlyyUIEvent flyyUIEvent) {
     
   }
});

To change the confetti colors

Use the below code to change the confetti color which gets shown when you win a ScratchCard. It will throw an IllegalArgumentException if the passed color string is incorrect.

List<FlyyColor> flyyConfettiColorList = new ArrayList<>();
flyyConfettiColorList.add(new FlyyColor("#ABABAB"));
flyyConfettiColorList.add(new FlyyColor("#F0987D"));
flyyConfettiColorList.add(new FlyyColor("#BFCADE"));
Flyy.setConfettiColors(flyyConfettiColorList);

Set Custom Domain

Use the below code to set the custom Domain name for Flyy SDK. Ensure you do not add https:// with the Domain.

Flyy.setBaseFlyyDomain("www.xyz.com");
Flyy.setBaseStageFlyyDomain("www.xyz.com");