Android sesame credit access (old version)
1. Add jar package, permission and manifest to configure activity
- zmxySDKALCmini_V1.01450366738902_release.jar Put it in the libs directory
- jurisdiction
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
- activity configuration
<!-- Sesame credit -->
<activity
android:name="com.android.moblie.zmxy.antgroup.creditsdk.app.SDKActivity"
android:label="Sesame credit"
android:screenOrientation="portrait" />
If not configured, the H5 authorization page will not appear
2. Request your own server to obtain sign, params and appId
3. Start authorization authentication
private CreditApp creditApp;
private Map<String, String> extParams = new HashMap<>();
creditApp = CreditApp.getOrCreateInstance(getApplicationContext());
creditApp.authenticate(this, appId, null, params, sign, extParams, new ICreditListener() {
@Override
public void onComplete(Bundle bundle) {
creditApp = null;
CreditApp.destroy();
//4. Submit the successful authorization information to the server
commitInfo(bundle);
}
@Override
public void onError(Bundle bundle) {
creditApp = null;
CreditApp.destroy();
}
@Override
public void onCancel() {
creditApp = null;
CreditApp.destroy();
}
});
The extParams parameter can place some additional parameters, such as when biz_params parameter forgets to organize auth_ When code parameter is used, auth can be brought in through extParams parameter_ code.
But suggest that auth_code parameters organized into biz_ Encrypt and sign in params.
extParams.put(“auth_code”, “M_ No, please ignore this sentence, you can pass empty object
creditApp = null;
CreditApp.destroy(); remember to close it, otherwise it cannot be called again
4. Register authorization callback
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
CreditApp.onActivityResult(requestCode, resultCode, data);
}
If not registered, 3.ICreditListener is invalid
5. Submit the successful authorization information to the server
private void commitInfo(Bundle bundle) {
String params = bundle.getString("params");
Map<String, Object> paramsMap = new HashMap<>();
paramsMap.put("params", params);
paramsMap.put("app", "neisha");
RequestNetData(4, paramsMap, "");
}
6. Access completed
Official document address
- Old version The Android part is missing
- New version