How to get a user profile on an Android device
1 answer
I found Roman Nurik answered a fairly similar answer, and mine thus builds on his answer. This is the gist of my answer . You will need to add permissions and features to in AndroidManifest.xml
order to navigate to the user profile:
<!-- Allows application to view phone state like using readLine1Number() -->
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<!-- Required to access the Contacts Provider and user profile -->
<uses-permission android:name="android.permission.READ_PROFILE"/>
<uses-permission android:name="android.permission.READ_CONTACTS"/>
<!-- Allows the application to use telephony to get the devices phone number when telephony is available without requiring telephony -->
<uses-feature android:name="android.hardware.telephony" android:required="false"/>
This approach uses one of two methods that Roman describes based on the API level supported on the device. It shows how user-defined primary fields can be used and when multiple values ββare specified. And to get the phone number of the device is used TelephonyManager
.
+5
source to share