Permission:
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
Code:AccountManager am = AccountManager.get(this);
Account[] accounts = am.getAccounts();
for (Account ac : accounts) {
String acname = ac.name;
String actype = ac.type;
// Take your time to look at all available accounts
System.out.println("Accounts : " + acname + ", " + actype);
}
Check actype for whatsapp accountif(actype.equals("com.whatsapp")){
String phoneNumber = ac.name;
}
No comments:
Post a Comment