ValidationManager library allow to us that check phone number easily.
- Check phone number
- Check email address
- Check credit card
Add it in your root build.gradle at the end of repositories:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
dependencies {
implementation 'com.github.serhatleventyavas:ValidationManager:2.0'
}
If you want retrieve countries, you can follow below code block.
val jsonParser: JsonParser = JsonParser(context)
val jsonArrayResult: JSONArray = jsonParser.readDataFromRawFile()
val countryList: ArrayList<Country> = jsonParser.parseCountry(jsonArrayResult)
If you want to check phone number by specific country, you can follow below code.
// for example Turkey country
val country: Country = countryList[0]
val result: Boolean = PhoneValidation.validPhoneNumber(country, "+90", "5551231233")
ValidationManager is released under the MIT license. See LICENSE for details.