Face++ SDK for Java, can be used in Android project.
Latest commit 97ad3ca Oct 25, 2013 @moon5ckq moon5ckq Update Readme.md


FacePlusPlus Java SDK

note: this branch has outdated, for new api please tray to use facepp-v3 branch.

This SDK uses apache.http lib and json lib.

1. Install

  1. download facepp.jar;
  2. add it to java project.

2. Import package

  • import com.facepp.*;


  • AutoComplete it with your editor or IDE.

3. Call FaceppAPI

  1. create a com.facepp.http.HttpRequests object

    HttpRequests httpRequests = new HttpRequests(you_api_key_string, you_api_secret_string);

  2. create a com.facepp.http.PostParameters object with all parameters

    PostParameters postParameters = new PostParameters().setUrl("http://faceplusplus.com/static/img/demo/8.jpg").setAttribute("all");

  3. request

    httpRequests.request("detection", "detect", postParameters);



  4. get the result use the com.facepp.json.FaceppJson object

    FaceppResult result = httpRequests.detectionDetect(postParameters);

4. Get value from result

  • Example:




5. Debug

  1. View the post request


  2. View the result like a pure json


  • a sample about multipart http post message

    Content-Disposition: form-data; name="PERSON_NAME"
    Content-Type: text/plain; charset=US-ASCII
    Content-Transfer-Encoding: 8bit
    Content-Disposition: form-data; name="GROUP_NAME"
    Content-Type: text/plain; charset=US-ASCII
    Content-Transfer-Encoding: 8bit

6. For Android

  • note that you can not requst on MainActivity, you need to new a thread to do what you want

  • note that you need add internet uses-permission into AndroidManifest.xml

    <uses-permission android:name="android.permission.INTERNET"/>

7. More sample codes

  • FaceppDemo

    An Java project with FaceppSDK

  • FaceppAndroidDemo

    An Android project with FaceppSDK

  • PictureDetect

    An Android application. To get a picture, detect with FaceppSDK, then mark all faces out.

7. Change Log

  • 1.0.0

    The default api

  • 1.1.0

    Add the new api `grouping' into SDK.

  • 1.2.0

    Add https request method, and set it to default. We can use debug = true to open http to instead of https.