NAV

Overview

Now a day to make app more popular developer has to generate virtual money management in the app in various events of application so that various features of app becomes popular by giving coins for the various events.Using this money developer gives right to convert this virtual money into real money of user can make purcheasing in various app features.Instead of this mecahnism developer can promote various third party apps in his application with the help of this powerful framework and user of his application is able to install,share and refer to these third part applications

MeReward Demo is app which apply photo effects of camera images and Gallery images.This app is avalable in Google Play and its source code avalable on Github.You can take all refrence of source code and how we integrate a power platform of Mego Reward as for the reward generation for various application custom events as well promotion of third party via install,share and referral.In this i represent i will guide you how we can integrate MeRewards to a App and how this power framework makes virtual currency managment so simple whether

This tutorial is divided into several parts, each focusing on a different aspect of our Mego Grid Demo App. Feel free to read them in any order, but we recommend that you download the source code and refer to it while reading. Some parts of the code were omitted or changed in this tutorial in order to keep it clear and concise, so you may find it useful to keep the full version close at hand.

MegoRewards demo architecture

MeRewards Demo app contains five main activities: SplashActivity handles the intializes logo delay which around 5 Second,MainActivity shows the effects catagories option whether is from camera and Gallery , PhotoActivity this activity apply different Effects on the images whether it is Capture from Camera or from Gallery,Help it is showing basic help content of app.

Aside from basic functinality we had integrate our MegoGrid Api in differnt section of application

Additions to these activity we have some other application pages which comes from MeReward Sdk as

Getting Started

Authorization

To use the MeUser SDK first of all you need to authenticate your application/device with our server. So to authenticate your application/device use the Authentication-Layer SDK and call the below mentioned code in your app launcher Activity.

Integrating Authorization SDK in your Android app

Inside the onCreate() method of your SplashActivity configure MegoAuthorizer SDK .

MegoAuthorizer megoAuthorizer = new MegoAuthorizer(SplashActivity.this);
megoAuthorizer.intializeSDK();

Show Campaign

Campaign is third party application promotions which is set on MeReward CMS panel.It consist of these parameters.In MeRewards these are following parameter which constitute a Compaign.

Show Earned History

This is centerlised page where user can see all the earned content which a user has earned through various actions whether it is performs through various application events and through compaign actions

In our demo app we use TextView widgets that are defined in the activity_main.xml layout to call history page functionality and is accessible via the options menu in MainActivity, but you can use any of the android widgets. We find the widgets in the onCreate() method of MainActivity to begin history calling flow:

 history = (TextView) findViewById(R.id.history);

We then add the calling history logic to the textview’s OnClickListener handler in the onCreate method:

history.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                MewardController.showEarnedHistory(MainActivity.this);
                closeDrawer();
            }
        });

In the code above, an OnClickListener handler is attached to the history textview that’s identified by the history resource. This in turn calls the showEarnedHistory API function of MewardController:

In addition to showEarnedHistory(Context context) function, two more functions are provided with additional parameters to modify the History page according to your application.

SendGift

Send Gifts is mechanism through a user is able to transfer his earned coins to other user. In send gift mechanism there is requirement of mail address to the entity which is going to receive gifts. A referal code will be sent to the email address that you have entered.

In our demo app we use TextView widgets that are defined in the activity_main.xml layout to send gifts to others functionality and is accessible via the options menu in MainActivity, but you can use any of the android widgets. We find the widgets in the onCreate() method of MainActivity to begin sending gift:

 send_gift = (TextView) findViewById(R.id.send_gift);

We then add the sending gift logic to the textview’s OnClickListener handler in the onCreate method:

send_gift.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                MewardController.showSendGiftBox(MainActivity.thisnew ExceptionHandler.IResponseHandler() {
                    @Override
                    public void onExceptionCallBack(MewardException mewardException) {
                        Toast.makeText(MainActivity.this, mewardException.getMessage(), Toast.LENGTH_SHORT).show();
                    }
                });
                closeDrawer();
            }
        });

In the code above, an OnClickListener handler is attached to the send_gift textview that’s identified by the send_gift resource. This in turn calls showSendGiftBox API function of MewardController.

ReceiveGift

Receive Gift is a mechanism in which you can earn the coins that another user has transfered to you. You will get the referal code on your email address.Copy the referal code and paste it on the receive gift box shown by the API function.

In our demo app we use TextView widgets that are defined in the activity_main.xml layout to perform logout functionality and is accessible via the options menu in MainActivity, but you can use any of the android widgets. We find the widgets in the onCreate() method of MainActivity to begin our Logout flow setup :

 receive_gift = (TextView) findViewById(R.id.receive_gift);

We then add the receiving gift logic to the textview’s OnClickListener handler in the onCreate method:

receive_gift.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                MewardController.showReceiveGiftBox(MainActivity.thisnew ExceptionHandler.IResponseHandler() {
                    @Override
                    public void onExceptionCallBack(MewardException mewardException) {
                        Toast.makeText(MainActivity.this, mewardException.getMessage(), Toast.LENGTH_SHORT).show();
                    }
                });
                closeDrawer();
            }
        });

In the code above, an OnClickListener handler is attached to the receive_gift textview that’s identified by the receive_gift resource. This in turn calls the showReceiveGiftBox API function of MewardController:

TotalEarnedCoins

This API will show total coins earned by user for reflecting this in multiple parts applications.

In our demo app we use TextView widgets that are defined in the activity_main.xml layout to get user’s total coins functionality and is accessible via the options menu in MainActivity, but you can use any of the android widgets. We find the widgets in the onCreate() method of MainActivity to begin getting total coins setup:

 total_coins = (TextView) findViewById(R.id.total_coins);

We then add the total_coins logic to the textview’s text in the onCreate method:

total_coins.setText(MewardController.getTotalCredits(MainActivity.this));

In the code above, we call the getTotalCredits function of MewardController which in turn return the value of user’s total coins in int data type.

Custom Actions

Overview

More making more user engagment MegoReward provides reward generation on app through different activity perform by user and by using different features.So every action in the app constitute of following components like

Triggering Actions

When any event is going to fired we have to trigger the same event in sdk for evalauting whether the rule which is configure on server is matched or not so for this we have trigger action when an camera image is taken by user and apply effects on it and any pic captured from gallery and apply efects on the same as below

MewardHandler mewardHandler = null;

if (type_click == Constant.GALLERY_EFEECT)
    mewardHandler = new MewardHandler.MewardBuilders().setEventID(“EIV5FOOO0”).setEventStatus(EventAction.ACTION_COMPLETED).build();
else if (type_click == Constant.CAMERA_EFEECT)
    mewardHandler = new MewardHandler.MewardBuilders().setEventID(“PJYDOH1GJ”).setEventStatus(EventAction.ACTION_COMPLETED).build();

This composed builder of generated event with associated properties and action is required to send RewardGenerator class which evalute this object with rules which is configure on server and performing action on that basis as below

RewardGenerator rewardGenerator = new RewardGenerator(PhotoActivity.this);
rewardGenerator.send(mewardHandler);




© 2015-2016 Megogrid Inc. / Term of service / Licenses / Privacy Policy 913 N Market Street Suite 200 Wilmington DE 19801 USA