-
-
Notifications
You must be signed in to change notification settings - Fork 506
Auto detect country
Harsh B. Bhakta edited this page Jul 18, 2020
·
4 revisions
- It can be enabled by adding XML property
app:ccp_autoDetectCountry="true"
in CCP view - Default value of app:ccp_autoDetectCountry is FALSE (Before 2.1.0, it was true which was confusing for many developers)
- app:ccp_rememberLastSelection="true" can override auto detected country by last selected country
- The country is detected at the runtime, so it can not be shown in the Android Studio preview of the layout.
- SIM_NETWORK_LOCALE is the default preference order
Library uses 3 ways to detect user's location.
- Using SIM info
- This will detect country from an inserted sim.
- Devices without sim tray will not give expected result
- Read more on official site.
- Using Network info
- This will detect country from connected network's information
- Read more in official site.
- Using Locale
- Detect country from device's locale info.
- Library provides flexibility when it comes to order of execution of these options.
- Order can be specified with
app:ccp_countryAutoDetectionPref="LOCALE_SIM"
- e.g. "SIM_ONLY" will detect country from sim card. If it fails then ccp will reset to default country.
- e.g. "SIM_NETWORK" will try from SIM details, if it fails then will try to find from network info then will reset to default country
- e.g. "SIM_NETWORK_LOCALE" will follow SIM -> NETWORK -> LOCALE order.
- SIM_ONLY
- NETWORK_ONLY
- LOCALE_ONLY
- SIM_NETWORK
- NETWORK_SIM
- SIM_LOCALE
- LOCALE_SIM
- NETWORK_LOCALE
- LOCALE_NETWORK
- SIM_NETWORK_LOCALE
- SIM_LOCALE_NETWORK
- NETWORK_SIM_LOCALE
- NETWORK_LOCALE_SIM
- LOCALE_SIM_NETWORK
- LOCALE_NETWORK_SIM
ccp_autoDetectCountry must be enabled to detect country at the time of layout prepartion
- How to Integrate into your project
- Full Number Support
- Use as a Country Selector
- Auto detect country
- Auto detect language
- Remember last selection
- Country Preference
- Custom Mater List
- Exclude Countries
- Example phonenumber as hint
- Multi Language Support
- Default Country
- Country Selection Listener
- Dialog events listener
- CCP Theme Customization
- CCP Dialog Theme Customization
- Custom TypeFace
- Read Selected Country
- XML Properties
- Update Guide to v2
- Guide to Add New Language Support
- Guide to add New Country
- Change contry names for local project
- Handle CCP ClickListener Manually
- Custom Dialog Title/Hint/Empty Result ACK
- Flag Emoji Support (BETA)
- Change Log