EDGE
Studio

EdgeSDK
Description
edgesdk is a complete suite that provides developers with all the features they need to enable mobile, TV, and tablet apps with the watch2earn service provided by EdgeVideo.com. This SDK includes all the necessary components to easily integrate watch2earn into your app.
Installation
Instructions for how to setup the sdk in you project
Step 1 [Adding maven repository ]
Add it in your root build.gradle at the end of repositories:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Step 2 [Adding dependency ]
Add the dependency
dependencies {
implementation 'com.github.EdgeCTO:edgesdk:Tag'
}
Usage
Step 1 [Initialize the SDK]
Use the following code snippet for initializing the sdk
EdgeSdk edgeSdk = new EdgeSdk(this);
Step 2 [Setting default values]
To make things in actions there are few default values which you must set while setting up sdk
edgeSdk.getLocalStorageManager().storeBooleanValue(true, com.edgesdk.Utils.Constants.IS_TICKER_ALLOWED_TO_HIDE);
edgeSdk.getLocalStorageManager().storeBooleanValue(false,com.edgesdk.Utils.Constants.IS_OPT_OUT_W2E_ENABLED);
edgeSdk.getLocalStorageManager().storeBooleanValue(true,com.edgesdk.Utils.Constants.IS_VIEWER_WALLET_ADDRESS_FORWARDED);
edgeSdk.getLocalStorageManager().storeStringValue("WALLET_ADDRESS",com.edgesdk.Utils.Constants.WALLET_ADDRESS);
Step 3 [Starting sdk operations]
You need to call the start() method using edgeSdk object this will call all necessary methods on backend
edgeSdk.start();
Step 4 [Starting staking]
Usually you need to call when you start watching a video becasue at that time you will be also setting base rate to 600-2400
edgeSdk.startStaking();
Step 5 [Ticker]
Importing and initialize SDK ticker
Ticker ticker = new Ticker(this,edgeSdk);
ticker.setBackpressed(false);
ticker.setPlaying(true);
Step 6 [Setting up Ticker over video layout]
We first find the main layout of the activity using the findViewById method. Then, we add the ticker view to this layout using the addView method. This will display the ticker over the video layout, as specified in Step 5
LinearLayout layout = findViewById(R.id.main_layout);
layout.addView(ticker);
Step 7 [Calling few methods in activity cycle method]
Calling a few methods in the activity lifecycle method onResume(). Specifically, the code ticker.onResume() needs to be called in onResume(). This method is used to resume the ticker animation and ensure that it is running properly when the activity is resumed from a paused or stopped state. It's important to call this method in onResume() to ensure that the ticker animation remains synchronized with the rest of the activity. Similarly, other methods may also need to be called in other activity lifecycle methods to ensure proper functionality of the SDK ticker.
ticker.onResume();
Step 8 [Updating base rate]
we are updating the base rate to start earning EAT. To do this, we need to call the updateBaseRateOnServer method from the W2EarnManager object of the edgeSdk. We pass the new base rate value as a parameter to this method. In this example, we are setting the base rate to 600. This will update the base rate on the server, and we will start earning EAT according to the new rate.
edgeSdk.getW2EarnManager().updateBaseRateOnServer(600);