PhoneNumber
?????????????????????????????????????????????????????????????? API???? English
??
?? gradle ??
dependencies {
compile 'org.xdty.phone.number:phone-number:0.7.13'
}
? maven
<dependency>
<groupId>org.xdty.phone.number</groupId>
<artifactId>phone-number</artifactId>
<version>0.7.13</version>
<type>aar</type> </dependency>
?? maven central ???? AAR ??
??
1. ?? meta-data
? AndroidManifest
<meta-data
android:name="org.xdty.phone.number.API_KEY"
android:value="API_KEY"/> <meta-data
android:name="org.xdty.phone.number.JUHE_API_KEY"
android:value="JUHE_API_KEY"/>
???? ?? API ?? ?? API_KEY
, ? ???? (360) ?? JUHE_API_KEY
????????????? API ???
????????? baidu_api_key
? juhe_api_key
? SharedPreferences
????? API ?????????? ???? ????
2. ?????????, ??????? example ? CallerInfo
new PhoneNumber(this, new PhoneNumber.Callback() {
@Override
public void onResponseOffline(INumber number) {
}
@Override
public void onResponse(INumber number) {
// Do your jobs here
textView.setText(number.getName());
}
@Override
public void onResponseFailed(INumber number) {
}
}
).fetch("10086", "10000", "10001", "OTHER_PHONE_NUMBER");
??????? onResponseOffline(INumber number)
?????????? onResponse(INumber number)
???
3. ??????? API
??? ??? API ??
4. ????????
??? model ??????? INumber
? NumberHandler
??????? fetch
??? addNumberHandler(new YourCustomNumberHandler())
?
5. ??????
??? only_offline_key
? SharedPreferences
????????? PhoneNumber(context, true, callback)
?????
6. ??????
???????? ??????->??????->??????->???????->Google?????->????? API->???? API->??????(360) API
??????? api_type
? SharedPreferences
???????????????????? getApiId()
????