Skip to content
MrDhruv edited this page Jan 14, 2016 · 24 revisions

Generic Partner Application

Generic Partner App is distribution of data between Ekstep(Genie) and it's partner(Akshara,Aser etc).

Generic Partner App will launch from Genie App and get back to Genie after completion of all process.

Generic Partner App will register one time after successful registration. It could be start session and send partner data to Genie Services.

In Generic Partner App, there is one configuration file(config.json) where Partner can define their name and own set of rules like number of fields with description with their data types.

The minimum requirements for Android Studio are:
Windows
1. Microsoft Windows 10/8/7/Vista/2003 (32 or 64-bit)
2.Java Development Kit (JDK) 7

Mac OS X

  1. Mac OS X 10.8.5 or higher, up to 10.9 (Mavericks)
  2. Java Runtime Environment (JRE) 6
    Java Development Kit (JDK) 7

Linux

  1. GNOME or KDE desktop
  2. Oracle Java Development Kit (JDK) 7

Software required
1.Android studio
http://developer.android.com/sdk/index.html

  1. JDK
    http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html

Installation
1.Install JDK
2.Set Path of JDK in Windows follow below links
http://www.javatpoint.com/how-to-set-path-in-java

After setting path restart system.
3.Install Android studio
After successful installation open Android studio.

Source Code
1.create folder(Partner_Name)
inside folder right click and select option
Git Bash Here

  1. type command
    a)From master -> git clone
    or
    b)From branch -> git clone -b branchName

    type username & password
    After successful this, You have source-code of Generic partner app.

Import Source Code into Android Studio
1.Open Android Studio

2.Select File option(from Top left corner) then select Open.. Option
Then select path of source code( e.g. C:\Partner_Name\Generic-Scripts-PUBLIC)

3.Left SIDE-BAR there is option project click on Project
You will see Generic-Scripts-PUBLIC(Project-name)

4.Click on Generic-Scripts-PUBLIC->app->src->main->assets->config.json

5.Open Config.json file
Change in this file according to your requirements.

6 . To Change Logo of App
a). Go inside particular folder
C:\Partner_Name\Generic-Scripts-PUBLIC\app\src\main\res
b). Copy icon inside
drawable-hdpi
drawable-mdpi
drawable-xhdpi
drawable-xxhdpi
drawable-xxhdpi

With respective dimensions name as partner_logo each image(there is already partner_logo just overwrite it)

7.Run option on Top toolbars
Click Run->Run app

7.After successful running it will build apk at following locations

C:\Partner_Name\Generic-Scripts-PUBLIC\app\build\outputs\apk
Generic-Partner-App-1.0.local-debug.apk

Now you can install this apk .
Enjoy :)

Here example of Config.json file

{
  "partnerName": "LME",
  "partnerId": "org.ekstep.partner.lme",
  "partnerPublicKey": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvgDm/lRk4ZU4ZUAaLRqXhzxGbRzSFOjOsIEgGAMYkh3+pULK/9evvOhI5X2afbnLLTo6h9MzjzWKio/G5jTH8YRS61ohBnhL8TKkVwXlU9GYnvOZimIoizPXimhNrVcAYvo4GNwrB9sxGFyNPup0CBCnyWifdhKOWGo5LGhNCP9ehmJJchPw23RN+VeF/fsW9WVJNTZFXy4WYbsM7YVGcQWYgCZX4eNqBcckP3aXaFTej1pPHfti2n+BLmudGK60lnZ4ePBidEi6WoPzpMrdMnwzkYOnQ8KBV0LKJr0vzqATzxGMC85fo1OUm+ZMobdl8SCLAzn5+2WFnNKyct1mtwIDAQAB",
  "sections": [
    //------------------Section represented by[ ] --------------------
    [
      {
        "SectionHeading": "Employee Details",  //Section 1st heading it will display on Top
        "instructions": {
          "title": "Star(*) denotes Mandatory field.",  //if Any instruction you want to give inside partucular section  as title
          "displayOrder": 2  // displayOrder representing position of  field ,it will show  at 2nd position inside partucular section
        }
      },
      {
        "fieldName": "Email-Id",   //It's fieldName which will display as Label
        "fieldvalue": {
          "fieldType": "Text",
          "fieldInputType": "textEmailAddress", //where user will enter email  e.g. dhruvraj123@gmail.com
          "validation": {
            "flag": false,  //false represents don't validate field
            "minimum": 8,   // It represents mimimum '8' character should  be
            "maximum": 12   // It represents maximum '12' character should  be
          }
        },
        "fieldHint": "enter aplhabet character",  //fieldHint as Help what fieldInputType should be
        "displayOrder": 1,  //displayOrder representing position of  field, it will show  at 1st position inside first section
        "fieldValues": []
      },
      {
        "fieldName": "FirstName", //It's fieldName which will display as Label
        "fieldvalue": {
          "fieldType": "Text",
          "fieldInputType": "text",//where user will enter FirstName  e.g. Dhruv
          "validation": {
            "flag": true,  //true represents  validate field
            "minimum": 3,  // It represents mimimum '3' character should  be
            "maximum": 25  // It represents maximum '25' character should  be
          }
        },
        "fieldHint": "enter aplhabet character",
        "displayOrder": 13,
        "fieldValues": []
      },
      {
        "fieldName": "Skills", //It's fieldName which will display as Label
        "fieldvalue": {
          "fieldType": "MultipleChoiceMore", //MultipleChoiceMore means You can select one or more options
          "fieldInputType": "None", //fieldInputType None means where user has to select from given option
          "validation": {
            "flag": true,  //true represents  validate field
            "minimum": 1,  // It represents mimimum '1' field has to select
            "maximum": 2   // It represents maximum  '2' field has to select
          }
        },
        "fieldHint": "You can select one or more options",
        "displayOrder": 5,
        "fieldValues": ["Java","PHP","Android","SAP"] // It showing the option list corresponding to field
      },
      {
        "fieldName": "Gender", //It's fieldName which will display as Label
        "fieldvalue": {
          "fieldType": "MultipleChoiceSingle", //MultipleChoiceSingle means You can select only one option
          "fieldInputType": "None",
          "validation": {
            "flag": true, //true represents  validate field
            "minimum": 1, // It represents mimimum '1' field has to select
            "maximum": 1  // It represents maximum '1' field has to select
          }
        },
        "fieldHint": "You can select one option only",
        "displayOrder": 6,
        "fieldValues": ["Male","Female"]
      },
      {
        "fieldName": "Password", //It's fieldName which will display as Label
        "fieldvalue": {
          "fieldType": "Text",
          "fieldInputType": "textPassword", //textPassword means it will hide what user is enetered e.g. ********
          "validation": {
            "flag": true, //true represents  validate field
            "minimum": 6,  // It represents mimimum '6' character should be
            "maximum": 10  // It represents maximum '10' character should be
          }
        },
        "fieldHint": "enter password max 10 char",
        "displayOrder": 4,
        "fieldValues": []
      },
      {
        "fieldName": "Joining Date", //It's fieldName which will display as Label
        "fieldvalue": {
          "fieldType": "Text",
          "fieldInputType": "date", //User has to select date from calander
          "validation": {
            "flag": true, //true represents  validate field
            "minimum": 1, // It represents mimimum '1' year should be from current date
            "maximum": 2 // It represents maximum '2' year should be from current date
          }
        },
        "fieldHint": "select date from calander",
        "displayOrder": 3,
        "fieldValues": []
      }
    ],
    //----------------------end of Section First-------------------------------------------
    //---------------------- Section Second-------------------------------------------

    [
      {
        "SectionHeading": "Address Details", //Section 2nd heading it will display below Section First
        "instructions": {
          "title": "",   //if Any instruction you want to give inside partucular section  as title, Here no instruction
          "displayOrder": 0 // displayOrder '0' means no title
        }
      },
      {
        "fieldName": "State", //It's fieldName which will display as Label
        "fieldvalue": {
          "fieldType": "DropDown", //DropDown means You can select only one option
          "fieldInputType": "None",
          "validation": {
            "flag": true, //true represents  validate field
            "minimum": 1, // It represents mimimum '1' has to select
            "maximum": 1 // It represents maximum '1'  has to select
          }
        },
        "fieldHint": "please select one state",
        "displayOrder": 1,
        "fieldValues": [
          "Karnataka",
          "Tamilandu",
          "Bihar"
        ]
      },
      {
        "fieldName": "Street Address", //It's fieldName which will display as Label
        "fieldvalue": {
          "fieldType": "TextComment",
          "fieldInputType": "textMultiLine", //textMultiLine means User can enter input more than one line
          "validation": {
            "flag": true, //true represents  validate field
            "minimum": 1, // It represents mimimum '1' line should be
            "maximum": 3  // It represents maximum '3' line should be
          }
        },
        "fieldHint": "enter address",
        "displayOrder": 2,
        "fieldValues": []
      }
    ],
    //----------------------end of Section Second----------------

    //------------------------Section third----------------------------
    [
      {
        "SectionHeading": "",// No heading
        "instructions": {
          "title": "",   //No title
          "displayOrder": 0 //No displaying position
        }
      },
      {
        "fieldName": "Age", //It's fieldName which will display as Label
        "fieldvalue": {
          "fieldType": "Text",
          "fieldInputType": "number", //where user can enter age as integer like 12,24,35,36 etc
          "validation": {
            "flag": true, //true represents  validate field
            "minimum": 3, // It represents mimimum value should be 3
            "maximum": 10 // It represents maximum value should be 10
          }
        },
        "fieldHint": "enter age in years only",
        "displayOrder": 1,
        "fieldValues": []
      },


      {
        "fieldName": "Mobile Number", //It's fieldName which will display as Label
        "fieldvalue": {
          "fieldType": "Text",
          "fieldInputType": "phone", //fieldInputType 'phone' means it will be integer like e.g. 8050691172
          "validation": {
            "flag": true, //true represents validate field
            "minimum": 10, // It represents mimimum '10' number should  be
            "maximum": 12  // It represents maximum '12' number should  be
          }
        },
        "fieldHint": "enter mobile number",
        "displayOrder": 2,
        "fieldValues": []
      },
      {
        "fieldName": "Price",
        "fieldvalue": {
          "fieldType": "Text",
          "fieldInputType": "numberDecimal", //where user can enter decimal values e.g. 50.65,75,85.82,
          "validation": {
            "flag": true,
            "minimum": 50,
            "maximum": 124
          }
        },
        "fieldHint": "enter Price ",
        "displayOrder": 10,
        "fieldValues": []
      }
    ]
  ]
}

Summary of Config.json

Any partner can change only following things
i)PartnerName
ii)PartnerId
iii)PartnerPublicKey
iv)Sections
1.SectionHeading
2.instructions
a)title b)Displayorder 3. fieldName
a)validation
-flag :true/false
minimum : integer value
maximum :integer value
4. fieldHint
5. fieldValues

Generic Partner App functionaliy( for partner developer)

  1. Register the partner(partner.register(String partnerID, String publicKey, IResponseHandler responseHandler))

  2. Read the configuration file(readConfigFile())

  3. Store the configuration file( storeConfigModel())

  4. To start OE_EVENT (generateOEStartEvent() )

  5. To display form (displayForm()) based on configuration file.

  6. To validate form data( isValidateData())

  7. Send data to Genie services( sendDataToGenieServices())
    i. End the partner session
    partner.terminatePartnerSession(Util.partnerId, endSessionResponseHandler)
    ii. Create Profile
    userProfile.createUserProfile(profile, userProfileResponseHandler)
    where you will get UID on succuess

    iv. Set current User
    userProfile.setCurrentUser(UID, currentuserSetResponseHandler)

    v. Get current User
    userProfile.getCurrentUser(currentGetuserResponseHandler);

    vi. Start session
    partner.startPartnerSession(Util.partnerId,startSessionResponseHandler);

    vii. Send partner data to Genie services
    partner.sendData(UID,partnerData,partnerDataResponseHandler);
    viii. To end OE_EVENT (generateOEEndEvent() )

  8. To exit the app(exitApp())

Clone this wiki locally