android check if a contact installed an app android (like whatsapp) - android

I want to let my app scan the users contactlist , and display the name of the contacts who also installed the app.
I have no idea where to begin with this . so if someone could help me getting started , that would be apreciated.
grtz

You will need to research ContentResolver because you will have to query the database containing the contacts. To do these queries, you will need the URI and column/header names for contacts db which can be found in the Contacts class.
You will also need users to register that they have your app on your own servers and the registration will need a piece of information about the user that other users would have in their contacts (the users phone number, email address, etc).
You will then need to query a few users at a time from the users contacts for this piece of information (using the ContentResolver and Contacts class), pass it to your server (as text) where it will check if they are registered, then send a message back to initial user (and possibly the match) that you found a match.
That's where you should start, and end :)
Note, you will need these permissions in the Manifest file:
android.permission.INTERNET
android.permission.READ_CONTACTS

First of all, welcome to StackOverflow. StackOverflow is for programming questions. As is such, a post asking for help should always provide a description of what you have already tried. If you haven't tried anything yet, I highly encourage you to try something, and post when you encounter a problem.
As your question stands now, we don't know what the problem is. Are you having problems scanning a contact list? Or are you having problems trying to figure out if another user has installed the app?
That being said, you will have to maintain a database for your app containing a list of people who have installed your app. When your app is launched on one device, do whatever you need to do to register the user in your database. Due to the nature of a "contact," one person's phone may only have their phone number, email address, or even just a name. This is of course something you will have to deal with in your implementation.

Related

Isolate Android Contact Provider

I want to create a Contact Provider so I can populate it from our database and let our business workforce to have all the customer data. That's the "easy" part.
But what I need is to isolate those contacts and avoid them to be cloned disallowing the people to copy/clone them and loosing track of that information.
Is there a way to do that? I haven't found a way to do that and I think the only way is to show the contacts in a custom Contact app. The problem with that solution is that it wouldn't be possible to know who's calling.
Is there a way to do that?
On an Android device, there will be roughly zero lines of code that knows anything about a custom ContentProvider that you create. If you do not want to share data from that provider, do not offer any UI to allow people to share data from that provider, and do not export the provider to third-party apps.
I haven't found a way to do that and I think the only way is to show the contacts in a custom Contact app
You needed to write that anyway. There are ~2 billion Android devices. None of them will have a Contacts-style app that knows anything about some custom ContentProvider that you create.
The problem with that solution is that it wouldn't be possible to know who's calling.
Correct. After all, the devices' call managers do not know anything about your custom ContentProvider.
Now, it could be that by "create a Contact Provider", you really meant "not create a Contact Provider". In this case, the "it" in "I can populate it from our database and let our business workforce to have all the customer data" might mean the standard Android ContactsContract ContentProvider. In this case, the Contacts app and in-call screens and everything else that works with contacts will work with your contacts. However, this is a system-supplied ContentProvider, exported to third-party apps, with documentation and so on. There are thousands of apps, both pre-installed and available via the Play Store and elsewhere, that can work with ContactsContract. You have no means of stopping that, and you have no means of preventing those apps from doing whatever it is that they want with this data.
IOW, you cannot satisfy "I want the Contacts app to have my contacts" and "I do not want the Contacts app to have my contacts" at the same time.

whatsapp hyperlink - combine whatsapp://send? with intent://send/

It's possible to have a button in my web page, for sending pre-filled messages to specific number?
i'm trying with
intent://send/+391234567890#Intent;scheme=smsto;package=com.whatsapp;action=android.intent.action.SENDTO;end;whatsapp://send?text=
nothing result.
have a solution? Thanks
Firstly, write the country code without +
Message me in WhatsApp
Sadly this does not work unless the number is already in your contacts list! Making it useless.
Here's what happens for me: I get a modal dialog saying the user is not on WhatsApp and I can either Invite or SMS. This is a mistake - they're DEFINITELY on WhatsApp, but not in my contacts because I've deleted them for testing.
Workaround idea
Offer vCard to save to Contacts
Since the phone number has to be in the Contacts list first, let's get it there. Track the site visitor to see if it's the first time she tapped on Contact me on WhatsApp (a cookie?). If it's the first time she tapped, make the link download your vCard
href="johnsmith.vcf"
The user now has to open the downloaded vCard with the People app, and add you to her Contacts.
Android intents URI FTW
When she returns, assuming she added you, make the button work with the intent:// URI scheme.
href="intent://send/391234567890#Intent;scheme=smsto;package=com.whatsapp;action=android.intent.action.SENDTO;end"
She taps on it and is magically transported to a WhatsApp chat with you.
Keep track of which href to present
Hopefully you can use the cookie you set to track her so you don't have the button offer the vCard AGAIN. There's no other way to know if your number is in her Contacts list unless you ask. But then it's not a button anymore, it's a form.
Same goes for Telegram. Security implications are probably the ones keeping Instant Messaging not so instant.

What is mechanism of Whatsapp application's Contacts syncing?

I have a requirement like, I can be able to find the people who are using a particular app from my contacts. It is much similar like Whatsapp contacts syncing.
Whatsapp contacts is so fast & very accurate. What is the logic for it?
I'm not sure of their exact logic, but a way that I have seen it done before is as follows...
Access the phone's contacts (duh)
Get the contact that you want to add as a "friend" in your app.
Cross reference that contact's phone number with the user information that you have stored in your application's database
If that phone number exists in your database of users, then you've got a match and you can process things however you'd like from there.
That's one way of doing it, but I don't know if that's exactly how WhatsApp does it. Hope this helps!

Android concept of the timestamps in contact, phone, emailaddress and so on

I have a few questions about the concept of androids timestamps. I want to synchronize my contacts but only if the timestamp of the contacts detail in the android is older than that one in my database.
My questions. Is there a timestamp for each detail like phonenumer, emailaddress and address. And who to check it? I tried it for ContactsContract.CommonDataKinds.Phone.STATUS_TIMESTAMP which is always null.
Any ideas? The Android Api tells me that there should be a timestamp (long).
Thanksfor your help.
There isn't. The field you're talking about is a convenience for someone who wants to stamp the row with the last time the raw contact's status was updated. I doubt that the Android system itself is using it.
I think that Contacts synchronization assumes that Google Contacts is the source of all knowledge, and the Android system is just a reflection of it. If something changes on Android, and it hasn't changed in Google Contacts, then it gets uploaded to Google Contacts. Changes on Google Contacts overwrite anything on Android.
On the whole, I'm suspicious of synchronization based on timestamps, because it has a tendency to get screwed up.
Are you trying to replace the google.com sync adapter with your own? You're a brave person!
CONTACT_LAST_UPDATED_TIMESTAMP
is added in the API 18. The same can be used.

Retrieve phone number with the help of id in facebook

I am able to retrieve most of the information with the help of id in facebook.Is it possible to retrieve phone number of friends,because Json Array generated after parsing id is not giving the phone number.If it is, then how?
Yes it is possible to retrieve the friends phone number once they come to your app and grant you the permissions. To get that friend to come to the app, you need to make your app so cool that each user will want to have all their friends using the app too. It's a hard challenge, but it can be done, take a look at FarmVille, etc for some inspiration .

Categories

Resources