Git Product home page Git Product logo

client-sdk-android's Introduction

Client-SDK-Android

Android client SDK for DApps.Support MEET.ONE SDK & SimpleWallet SDK.

MEET.ONE SDK

Features

  • Get EOS Account: DApp can request EOS Authorization for an EOS Account.
  • EOS Transfer: DApp can send EOS Transferation.
  • Push EOS Transactions: DApp can push EOS Transactions.
  • Request EOS Custom Signature: DApp can request EOS Custom Signature.

SimpleWallet SDK

Features

  • Get EOS Account: DApp can request EOS Authorization for an EOS Account.
  • EOS Transfer: DApp can send EOS Transferation.

Installation

1. Copy 'meetlib.aar' to your app lib

2. Reference meetlib library to your app

2.1 Copy the following code to android in your app's build.gradle

repositories {
    flatDir {
        dirs 'libs'
    }
}

2.2 Copy the following code to dependencies in your app's build.gradle

compile(name: 'meetlib', ext: 'aar')

3. Copy code to your AndroidManifest.xml

<activity android:name="com.meetone.meetlib.RouterActivity">
    <intent-filter>
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.DEFAULT" />
    <category  android:name="android.intent.category.BROWSABLE" />
    <data android:scheme="Custom Scheme" />
    </intent-filter>
</activity>

Notice: you need modify "Custom Scheme" to Your DApp's scheme.

4. Add Dependency

fastjson com.alibaba:fastjson:1.1.70.android

MEET.ONE SDK Usage

1.Request EOS Authorization

Code Samples

Authorize authorize = new Authorize();
authorize.setDescription("get account info ");

AppInfo appInfo = new AppInfo();
appInfo.setName("app name");
appInfo.setIcon("app icon");
appInfo.setDappCallbackScheme("http");
appInfo.setDappRedirectURL("https://meet.one");
appInfo.setDescription("this is a demo");
appInfo.setVersion("app version");
MeetOneManager.getInstance().requestAuthorize(this,authorize,appInfo, new MeetOneCallBack() {
    @Override
    public void callBack(Map<String, String> paramMap, CallBack callBack) {
        Log.d("MeetOneManager",paramMap.toString()+"  "+callBack.getData());
    }
});

2.EOS Transfer

Code Samples

AppInfo appInfo = new AppInfo();
appInfo.setName("app name");
appInfo.setIcon("app icon");
appInfo.setDappCallbackScheme("http");
appInfo.setDappRedirectURL("https://meet.one");
appInfo.setDescription("this is a demo");
appInfo.setVersion("app version");

Transfer transfer = new Transfer();
transfer.setAmount("0.0001");
transfer.setDescription("i like");
transfer.setFrom("aaaa");//from account name
transfer.setTo("bbbb");//to account name
transfer.setTokenName("EOS");
transfer.setTokenContract("eosio.token");
transfer.setTokenPrecision(4);//set token Precision
transfer.setMemo("aaaa transfers 12.0 EOS to bbbbb");

MeetOneManager.getInstance().requestTransfer(this, transfer, appInfo, new MeetOneCallBack() {
    @Override
    public void callBack(Map<String, String> paramMap, CallBack callBack) {
        Log.d("MeetOneManager", paramMap.toString() + "  " + callBack.getData());
    }
});

3.Push EOS Transactions

Code Samples

AppInfo appInfo = new AppInfo();
appInfo.setName("app name");
appInfo.setIcon("app icon");
appInfo.setDappCallbackScheme("http");
appInfo.setDappRedirectURL("https://meet.one");
appInfo.setDescription("this is a demo");
appInfo.setVersion("app version");


Transaction transaction = new Transaction();
transaction.setDescription("test demo");
String action1 = "{\"account\":\"eosio.token\",\"name\":\"transfer\",\"authorization\":[{\"actor\":\"aaaa\", \"permission\":\"owner\"}],\"data\":{\"from\":\"aaaa\", \"to\":\"bbbb\",\"quantity\":\"0.0001 EOS\",\"memo\":\"test\"}}";
List<String> actions = new ArrayList<>();
actions.add(action1);
transaction.setFrom("aaaa");//from account name
transaction.setActions(actions);
String options = "{\"broadcast\":true}}";
transaction.setOptions(options);
MeetOneManager.getInstance().requestTransaction(this, transaction, appInfo, new MeetOneCallBack() {
    @Override
    public void callBack(Map<String, String> paramMap, CallBack callBack) {
        Log.d("MeetOneManager", paramMap.toString() + "  " + callBack.getData());
    }
});

4.Request EOS Custom Signature

Code Samples

AppInfo appInfo = new AppInfo();
appInfo.setName("moreone");
appInfo.setIcon("app icon");
appInfo.setDappCallbackScheme("moreone");
appInfo.setDappRedirectURL("https://meet.one");
appInfo.setDescription("this is a demo");
appInfo.setVersion("2.4.0");

Signature signature = new Signature();
signature.setAccountName("aaaaa");//provider account name
signature.setData("moreone");//custom signature string
signature.setDescription("this is a demo");//request reason
MeetOneManager.getInstance().requestSignature(this, signature, appInfo, new MeetOneCallBack() {
    @Override
    public void callBack(Map<String, String> paramMap, CallBack callBack) {
        Log.d("MeetOneManager", paramMap.toString());
        mViewBinding.tvContent.setText(paramMap.toString());
    }
});

SimpleWallet SDK Usage

1.Request EOS Authorization

Code Samples

SimpleWalletLogin login = new SimpleWalletLogin();
login.setDappName("more one app");
login.setDappIcon("more one icon");
login.setUuID("xxxx");//uuid
login.setLoginUrl("https://demo/api/login");
login.setLoginMemo("login Memo");
login.setCallback("moreone://login?action=login");
MeetOneManager.getInstance().requestLogin(this, login, new SimpleWalletCallBack() {
    @Override
    public void callBack(Map<String, String> paramMap, String callBack) {
        Log.d("MeetOneManager", paramMap.toString());
        mViewBinding.tvContent.setText(paramMap.toString());
    }
});

2.EOS Transfer

Code Samples

SimpleWalletPay pay = new SimpleWalletPay();
pay.setDappName("more one app");
pay.setDappIcon("more one icon");
pay.setFrom("aaaaaa");
pay.setTo("bbbbb");
pay.setAmount("0.0001");
pay.setSymbol("EOS");
pay.setPrecision(4);
pay.setContract("eosio.token");
pay.setDesc("i am test");
pay.setCallback("moreone://login?action=login");
MeetOneManager.getInstance().requestPay(this, pay, new SimpleWalletCallBack() {
    @Override
    public void callBack(Map<String, String> paramMap, String callBack) {
        Log.d("MeetOneManager", paramMap.toString());
        mViewBinding.tvContent.setText(paramMap.toString());
    }
});

client-sdk-android's People

Contributors

fubin0083 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.