How to get user gmail contacts and send Email from android phone - android

How to get the Gmail contacts data includes like first Name,Last-name B Day Email address Phone Number and the User Photo.How to send Email to a gmail contact from the android Phone.Using the Face Book SDK we can able to get the user contacts details but the Gmail is not come up with a SDK how to get these details.

The class you're looking for is the ContactsContract. The documentation is here.
Nested within ContactContract is a table of common data types, for instance, the contact photo:
java.lang.Object
↳ android.provider.ContactsContract.CommonDataKinds.Photo
Once you have the contact information you need, this question covers using an intent to send an email.

Related

How to update my profile photo in Contacts App from another application in Android?

I want to update the profile photo and name for the User Profile in Contacts App from another app in Android. I could not find any way to do that. I have referred Android documentation to modify contacts and Android documentation for User Profile. Can anyone suggest how to update profile photo and name from another application?
You‘d want to sent a Contact.Intent from the App with the coresponding data so that the Contact App can handle the Intent and update the coresponding contact.

how to check if a phone number is valid whatsapp number in Android?

so I have an edit text that will be used as a view to get phone number from user, say if the phone number is +6123456789 , I want to check if this number has whatsapp number or not,i want to avoid the user to input fake whatsapp number, how to do that ?
Update (Nov 2022):
Whatsapp are repurposing the contacts node starting in v2.43 to no longer provide status information about a phone number. Regardless of whether a user has WhatsApp, it will always return valid for status in the response. For more information see official docs
original answer:
You must have: Facebook Whatsapp Business Api for contacts check
Once you have a valid business account you could then query the Contact. You will get all the details in the documentation.
Hope it works for you!
You can try this service https://watverifyapi.live
It allows you to verify multiple whatsapp number at a time.

How to display contact name in MIT App Inventor

Could you help me to find out how I will get and display contact name.
I am able to get and display the contact number only, but what I need is to get the data of contact name via contact number saved on the phone. This is for my school project purposes.
I am using MIT App inventor. What should I do?
Here is a screenshot of my blocks
The texting component does not provide that information. As you can see, you can only get the number and the message text.
To get the contact name, you could use the Read Contact Extension by Andres Daniel. Note: this is a paid extension.
For a list of available extensions, see https://puravidaapps.com/extensions.php

how to display device address book ordered by custom external data

In my android application I would like to display the mobile user's contacts (names, profile picture ) displaying first the contacts that have already installed and registrered that application (the matching is made by contact's email).
Trying to loop over each contact and match if their email is already registered (in an external SQLITE table) don't seems to be an efficient way.
I would like to directly add (somewhere in the address book ?) the extra data "isRegistered = true/false) and order my addreess book query by this value to scroll the address book.
Is it possible? How to implement this in detail ?
OPTION 1
I think the most efficient way would be what you thought about initially, with a slight improvement:
store the list of registered emails (for the user's contacts) in a local SQLite DB.
read the entire list of emails on application launch, and store them in a HashSet
When sorting the contacts, create a custom Comparator to first check if the contact is an app user or not, and only then fallback to name compare.
OPTION 2
If you still want to check the option of storing the custom value in the Contacts DB, and integrate it into your query, you need to create a SyncAdapter.
This is basically a service that is able to sync contacts to/from a server into your own RawContact, which is then aggregated into one-or-more existing RawContacts, like Google does for Google Contacts.
You can set it to be notified when a new contact is added, and have your SyncAdapter add the needed info to the contact so it'll show links to your app.
If you go to your phone settings > accounts, you can see Whatsapp and Google's SyncAdapters there, where you can turn them off/on.
To create a sync adapter, you can follow the official docs, or this great tutorial.

Send Email or SMS based on the contact picked

I am trying to develop an app, where one of the requirement is to send email or SMS to the contact which the user picks. When the user needs to send message, they can pick the contact from the contact list. If the user selects the "phone number" of the contact, I need to start SMS application and insert my message contact. If the user selects the contact email address from the contact list, I need to open the EMail application with my content in Subject and body.
How do the application know about the user input??
I am not an expert on this topic but it is interesting to me so I have done some reading about it.
You have the action of selecting a phone number or email address right? So if the user selects a phone number you can use SmsManager for that (here is an article about it http://mobiforge.com/developing/story/sms-messaging-android ). And a related Stack Overflow article discusses sending emails on the Android platform and one user gives a very nice Java example of doing this. Here is the article: Sending Email in Android using JavaMail API without using the default/built-in app
I hope these might be of some help!

Categories

Resources