Code Monkey home page Code Monkey logo

maepaysoh-android's Introduction

QUICK OVERVIEW

Content မာတိကာ

  1. What is this Repository?
  2. Minimum requirements.
  3. MaePaySoh API.
  4. MaePaySoh SDK Overview. ⤵️
  5. How to use this Repository?
    • 5.1 Add MaePaySoh Android SDK for your Android Project ⤵️
    • 5.2 Get MaePaySoh API Key
    • 5.3 Setup API Wrapper ⤵️
    • 5.4 Use of API Helpers
    • 5.4.1 How to use PartyAPIHelper ⤵️
    • 5.4.2 How to use CandidateAPIHelper ⤵️
    • 5.4.3 How to use FAQAPIHelper ⤵️
    • 5.4.4 How to use GeoAPIHelper ⤵️
  6. Contributions

1. What is this Repository?

This is part of the Opensource Libraries for MaePaySoh မဲပေးစို့ project.

This repository is an Android Project which comprises of 2 major parts;

  1. Sample Android Application (sample-app Module) and
  2. Android SDK (maepaysohsdk Module) for MaePaySoh API

The sample-app module utilizes maepaysohsdk as a dependency.

2. Minimum Requirements

Followings are required to build this project folder;

  • Android SDK API 14
  • Build Tool Version 23
  • Gradle Version 2.4

3. MaePaySoh API

MaePaySoh API is the primary data provider for this Android Application sample-app. The SDK maepaysohsdk module is the client library and complys to MaePaySoh API specification.

API features are tested with this PostMan Collection for the development of SDK.

4. MaePaySoh SDK Overview

Followings are primary utility functions of SDK to get data from API.

  1. MaePaySohApiWrapper, this is helper-class-generator.
  2. PartyAPIHelper, wrapper class for Party API endpoints.
  3. CandidateAPIHelper, wrapper class for Candidate API endpoints.
  4. FAQAPIHelper, wrapper class for FAQ API endpoints.
  5. GeoAPIHelper, wrapper class for Geolocation endponts.

5. How to use this Repository?

The SDK in this repository can be used as dependency for your Android Application, or you can fork and transform the Sample Application to further creative ideas.

5.1 Add MaePaySoh Android SDK for your Android Project

To use the SDK as dependency for your own Android Project.

  • Clone this repository maepaysoh-android.
  • Create your own new Android Project in Android Studio.
  • Open File > New > Import Module.
  • Select maepaysohsdk folder in maepaysoh-android project folder.
  • Open File > Project Structure to open Project Structure dialog.
  • Select your own project module (e.g app) under Modules selection.
  • Select Dependencies tab.
  • Add new Module depedency by clicking + button.
  • Select maepaysohsdk and click OK

5.2 Get MaePaySoh API Key

Own API key is required to connect to Mae Pay Soh API. It is required to put into SDK to connect to API. You can get your own APK Key at MaePaySoh Website.

5.3 Setup API Wrapper

You can setup the API Wrapper as follow;

MaePaySohApiWrapper apiWrapper = new MaePaySohApiWrapper(this);
apiWrapper.setApiKey(API_KEY); // Put your own API Key
apiWrapper.setFont(MaePaySohApiWrapper.FONT.unicode); // Set Unicode/Zawgyi

5.4 Use of API Helpers

APIHelpers are generated from MaePaySohApiWrapper object.

5.4.1 How to use PartyAPIHelper

Party API Helper is created as follow;

PartyAPIHelper partyApiHelper = apiWrapper.getPartyApiHelper();

Followings methods are available for PartyAPIHelper

  • getParties() 📄 returns List<Party> list of Party Objects.
  • getPartiesAsync 📄 📋 pre-included AsyncTask call to provide Callback Function.
  • getPartiesFromCache📄 loads List<Party> from cache in case of Offline.
  • searchPartiesFromCache📄 returns List<Party> list of Party Objects in cache, matches with search string.
5.4.2 How to use CandidateAPIHelper

Candidate API Helper is created as follow;

CandidateAPIHelper candidateApiHelper = apiWrapper.getCandidateAPIHelper();

Following methods are available for CandidateAPIHelper;

  • getCandidates retrieve candidate list from API.
  • getCandidatesAsync function with AsyncTask, which accepts callback function.
  • getCandidatesFromCache retrieve candidate list from cached data.
  • searchCandidateFromCache search candidate list from cached data.
  • getCandidateById retrieve candidate by given ID from API.
  • getCandidateByIdAsync function with AsyncTask, which accepts callback function.
  • getCandidateByIdFromCache retrieve candidate for given ID from cached data.
5.4.3 How to use FAQAPIHelper

FAQ API Helper is created as follow;

FAQAPIHelper faqApiHelper = apiWrapper.getFAQAPIHelper();

Following methods are available for FAQ API Helper.

  • getFaqs retrieve FAQ data from API.
  • getFaqsAsync included AsyncTask, which accepts callback function.
  • getFaqsFromCache retrieve FAQ data from cache.
  • searchFaq search in FAQ data from API.
  • searchFaqsAsync included AsyncTask, which accepts callback function.
  • searchFaqFromCache search in FAQ data from cache.
  • getFaqById retrieve FAQ entry for given ID from API.
  • getFaqByIdAsync included AsyncTask, which accepts callback function.
5.4.4 How to use GeoAPIHelper

Geo API Helper is created as follow;

GeoAPIHelper geoApiHelper = apiWrapper.getGeoAPIHelper();

Following methods are available for Geo API Helper

  • getLocationList retrieve geo location list.
  • getLocationListAsync added AsyncTask which accepts callback function.
  • getLocationByObjectId retrieve geo location by given pcode.
  • getLocationByRegion retrieve geo location for given Region names.
  • getLocationByRegionByAsync added AsyncTask which accepts callback function.

6. Contributions

maepaysoh-android's People

Contributors

yemyatthu1990 avatar yelinaung avatar kotharthar avatar

Watchers

Shwe Yamin 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.