Commit 499e9b3c authored by Prakhar Agrawal's avatar Prakhar Agrawal
Browse files

Update readme.md

parent 459b22f8
Loading
Loading
Loading
Loading
+37 −0
Original line number Diff line number Diff line
# Leegality Android SDK 3.0#

### Steps to Use ###

1. Download Leegality Library from 
http://gitlab.leegality.com/leegality-public/android-sdk/blob/master/leegality.aar
2. Import Leegality Library to your project by following the steps laid down in https://developer.android.com/studio/projects/android-library.html#AddDependency. 
3. To initialize signing, start activity Leegality provided by the Leegality Library. 
Pass signing URL in url key.
    <br __>Eg. `Intent intent = new Intent(getApplicationContext(), Leegality.class);
	intent.putExtra("url", "signing-url-here");
	startActivityForResult(intent, REQUEST_CODE);
	//REQUEST_CODE is your constant, which is used to identify particular activity.`

#### Note: It is recommended to start signing process by using startActivityForResult instead of startActivity to receive the response/error. 

### Result: ###

Override method onActivityResult to check the response of signing process.

1. In case of successfully completion of signing process, signing window will be closed automatically and you will get a response with key name 'message' and corresponding 'success message' in the Intent.
2. In case of error in signing process, signing window will be closed automatically and you will get a response with key name 'error' and corresponding 'error message'.


`@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data){
	//Check requestCode, If it match with the provided REQUEST_CODE then this response is for the signing process.	
	if(requestCode == REQUEST_CODE){
		String error = data.hasExtra("error") ? data.getExtras().getString("error") : null;
		String message = data.hasExtra("message") ? data.getExtras().getString("message") : null;
		if(error != null){		
			log.info("Error: ", error);
		}else if(message != null){
			log.info("Message: ", message);
		}		
	}
	super.onActivityResult(requestCode, resultCode, data);
}`