# :-: Android SDK
**1. Get the `Alipay SDK` from [ here](https://docs.open.alipay.com/54/104509)**
**2. Add Alipay SDK to your project ` libs ` directory**
**3. Config your project `build.gradle`**
~~~
allprojects {
repositories {
flatDir {
dirs 'libs'
}
google()
jcenter()
}
}
~~~
**4. Config your app module `build.gradle`**
~~~
dependencies {
compile (name: 'alipaySdk-15.6.0-20190226104053', ext: 'aar')
}
~~~
**5. Application for Runtime Permissions in `AndroidManifest.xml`**
~~~
android.permission.INTERNET
android.permission.ACCESS_NETWORK_STATE
android.permission.ACCESS_WIFI_STATE
android.permission.READ_PHONE_STATE
android.permission.WRITE_EXTERNAL_STORAGE
~~~
If your `targetsdk` version is above `23 ` , you need to apply to the user for the following permissions at runtime
~~~
WRITE_EXTERNAL_STORAGE
READ_PHONE_STATE
~~~
**6. Android Java code:**
~~~
final String orderInfo = info; // your order infomation
Runnable payRunnable = new Runnable() {
@Override
public void run() {
PayTask alipay = new PayTask(DemoActivity.this);
Map <String,String> result = alipay.payV2(orderInfo,true);
Message msg = new Message();
msg.what = SDK_PAY_FLAG;
msg.obj = result;
mHandler.sendMessage(msg);
}
};
// 必须异步调用
Thread payThread = new Thread(payRunnable);
payThread.start();
~~~
**What you need to develop with our API is to:**
1. Query your app paychannels using (PayTools.json API)
2. Init each paychannel with the result in step 1
3. Show the paychannel in the cashier page
4. Create pay order for the channel using (CreateOrder.json API)
5. Invoke the pay api
6. Query the pay result and show the result page (QueryOrder.json API)