Skip to main content

Pataa Autofill Android SDK Implementation Guide

image

image

image

Step 1. Download Pataa_autofill_sdk.arr file from the git repository

https://github.com/pataa-com/Address-Autofill-Android

Step 2. Put pataa_autofill_sdk.aar in your project lib folder

Step 3. Add below line in app level build.gradle


implementation fileTree(dir: "libs", include: ["*.aar"])

Step 4. Add Metadata in manifest

        <meta-data
android:name="pataa.autofill.sdk.ClientKey"
android:value="@string/PATAA_API_KEY" />

<meta-data
android:name="pataa.autofill.sdk.EnableLogger"
android:value="true" />

<meta-data
android:name="pataa.autofill.sdk.EnableDevelopment"
android:value="false" />

Step 5. Add view on xml (Don't change the id)

        <com.pataa.sdk.PataaAutoFillView
android:id="@+id/vPataaCodeView"
android:layout_width="match_parent"
android:layout_height="match_parent" />

Step 6. Set properties and listener(Only for JAVA), For kotlin skip this step

((PataaAutoFillView) findViewById(R.id.vPataaCodeView))
.setCurrentActivity(this)//to get the result of create pataa
.setAddressCallBack(new OnAddress() {//to get the click events
@Override
public void onNetworkIsNotAvailable() {
Toast.makeText(MainActivity.this, "onNetworkIsNotAvailable", Toast.LENGTH_SHORT).show();
}
@Override
public void onPataaNotFound(String message) {
}
@Override
public void onPataaFound(User user, Pataa
response) {
Toast.makeText(MainActivity.this, user.getFirst_name() + " : " + response.getFormattedAddress()
, Toast.LENGTH_SHORT).show();
}
});

Step 7. Set properties and listener(Only for Kotlin), For Java skip this step

findViewById<PataaAutoFillView>(R.id.vPataaCodeView)
.setCurrentActivity(this)
.setAddressCallBack(object : OnAddress {
override fun onNetworkIsNotAvailable() {
Toast.makeText(applicationContext, "onNetworkIsNotAvailable", Toast.LENGTH_SHORT).show();
}
override fun onPataaNotFound(message: String?) {
}
override fun onPataaFound(user: User?, response: Pataa?) {
Toast.makeText(applicationContext, user?.getFirst_name() + " : " + response?.getFormattedAddress()
, Toast.LENGTH_SHORT).show();
}
})

Step 8. Add PATAA api key on string.xml

        <resources>
.....
<string name="PATAA_API_KEY">+ipXPwNxxxxxxxxxxxxxxxxxxxxxxxxxxxxxvkk=</string>
<resources>

In case of errors

        E/PATAA_SDK_LOGS: {"msg":"Invalid App key","status":600}
E/PATAA_SDK_LOGS: Invalid App key

Solution : Enable logs from manifest metadata and copy the SHA1 key. Put it on pataa developer console, and then try again you will got the results

        E/PATAA_SDK_LOGS: {"msg":"Your key is deavtivated please generate new","status":200}
E/PATAA_SDK_LOGS: Invalid App key

Solution : Enable the key for use on Pataa developer console or Create new key.

        E/PATAA_SDK_LOGS: {"msg":"Pataa Code not found","status":204}
E/PATAA_SDK_LOGS: Pataa Code not found

Solution : Try to search with valid pataa code like - KUMAR100, SINGH221, Because your searched pataa code is not created on pataa platform yet.

        E/PATAA_SDK_LOGS: {"msg":"Pataa Search Limit Over","status":400}
E/PATAA_SDK_LOGS: Pataa Search Limit Over
E/PATAA_SDK_LOGS: {"msg":"Invalid API key or App key,you are not authorized.Please provide a valid key","status":400}
E/PATAA_SDK_LOGS: Invalid API key or App key,you are not authorized.Please provide a valid key

or any other error: Please refer the document