Giter Club home page Giter Club logo

ppcom-android-sdk's Introduction

PPComDemo

A demo use PPComSDK via gradle.

To use local source project instead of bintray gradle. Use settings.gradle.local to ooverwrite settings.gradle and use gradle.build.local to overwrite gradle.

And do the same for PPComSDK!

A config-build.sh is intented to help build from local or jcenter.

  • build demo reference local source
sh config-build.sh local
  • build demo reference jcenter
sh config-build.sh jcenter

The script will link settings.gradle and build.gradle for you.

PPComSDK

PPComSDK which depends on PPMessageSDK.

Two steps to use PPComSDK

  • Create and initialize PPComSDK by using basic information.
public class MyApp extends Application {
    
    @Override
    public void onCreate() {
        super.onCreate();
        
        PPComSDK sdk = PPComSDK.getInstance();

        // Global config PPComSDK
        PPComSDKConfiguration.Builder builder = new PPComSDKConfiguration.Builder();
        sdk.init(builder.setContext(this)
                 .setAppUUID("YOUR_APP_UUID")
                 .setApiKey("PPCOM_API_KEY")
                 .setApiSecret("PPCOM_API_SECRET")
                 .setServerUrl("YOUR_SERVER_URL")

                 .setUserFullName("YOUR_USER_FULL_NAME")
                 .setUserEmail("YOUR_USER_EMAIL")
                 .setEntUserUUID("YOUR_ENT_USER_UUID")
                 .setEntUserType("YOUR_ENT_USER_TYPE")

                 .setJpushRegistrationId("JPUSH_REGISTRATION_ID");
                 
                 .setInputHint("Any questions") // default is ""
                 .setActionbarBackgroundColor(getResources().getColor(
                                                                      android.R.color.holo_blue_dark))
                 .setActionbarTitleColor(Color.WHITE)
                 .setEnableLog(true) // default is false
                 .setEnableEnterKeyToSendText(true) // default is false
                 .build());

    }
}

If enterprise user uuid is set, the user is identified by this uuid; if user email is set, the user is identified by email. If you want to set the user type, must set here, not update() of PPComSDK.

  • Extend ConversationsActivity to start conversation

sdk.update() is optional and only user full name, user icon url and ent user data could be update. If you want to clear data, set it to an empty string.

sdk.update() must called after sdk.init() success, otherwise RuntimeException will be throwed.

public class MainActivity extends ConversationsActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        PPComSDK sdk = PPComSDK.getInstance();

        // Optional !
        sdk.update(new PPComSDKConfiguration.Builder()
        
                   .setUserFullName("YOUR_USER_FULL_NAME")
                   .setUserIcon("YOUR_USER_ICON_URL")
                   .setEntUserData("YOUR_ENT_USER_DATA")
                   .setJpushRegistrationId("YOUR_JPUSH_REGISTRATION_ID")
                 
                   .build());

        startUp();
    }

}

PPMessageSDK

PPMessageSDK is core lib and distributed with gradle.

ppcom-android-sdk's People

Contributors

anxiaoyi avatar dingguijin 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.