This is the framework to list different type of rewards and provide functionality to redeem those rewards.
Framework is made by Rewardz developer team.
Rewardz Redemption Library can be included in any Android application.
Rewardz Redemption Library supports Android 2.3 (Gingerbread) and later.
Add the JitPack repository to your build file
allprojects { repositories { ... maven { url 'https://jitpack.io' } } }
Add this in your build.gradle
compile 'com.github.rewardz:RewardzRedemption-Android:0.1.3'
Sync gradle.
In your Activity/Fragment class implements RewardzRedemption.OnRewardsListListener, RewardzRedemption.OnRewardsRedeemed
and override methods onRewardsListComplete()
and onRewardsRedeemed()
.
Your class should look like below:
public class MainActivity extends AppCompatActivity implements RewardzRedemption.OnRewardsListListener, RewardzRedemption.OnRewardsRedeemed
{
@Override
public void onRewardsListComplete(String jsonResponse) {
Log.v("Tag", "onRewardsListComplete ==> "+jsonResponse);
}
@Override
public void onRewardsRedeemed(String jsonResponse) {
Log.v("Tag", "onRewardsRedeemed ==> "+jsonResponse);
}
}
Collect oAuth Token provided by our support team or from admin panel and put it in your source code.
private final String oAuthToken = "Token <token_by_admin_panel>";
To Load rewards list in your app, you have to call:
RewardzRedemption.getInstance(this, this, this).getRewardsList(oAuthToken);
This line will give you all rewards in JSON array format that you will get in below overrided method:
@Override
public void onRewardsListComplete(String jsonResponse) {
Log.v("Tag", "onRewardsListComplete ==> "+jsonResponse);
}
To Redeem perticular reward in your app, you have to call:
RewardzRedemption.getInstance(this, this, this, this).redeemRewards(oAuthToken, paramMap);
This line will give you result in JSON format after redeeming any reward that you will get in below overrided method:
@Override
public void onRewardsRedeemed(String jsonResponse) {
Log.v("Tag", "onRewardsRedeemed ==> "+jsonResponse);
}
And, It's done. Voilla...!
Start creating your own UI as per your app design and load rewards list and give your app's user to redeem them whenever they want. Happy Coding.
- Support it by clicking the ⭐️ button on the upper right of this page. ✌️
Copyright (C) 2016 Rewardz Pte Ltd
Copyright (C) 2011 Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Just make pull request. You're in!