Lauch my application Intent from android contact details - android

I want to lauch my application Intent from android contact details, like Whatsapp does.
I mean that when you go to native contacts application and open a contact's details you should see, among the details shown, an action to be performed by my own application.
This is possible beacause Whatsapp does it.
Can you help me?
Please.

Yes, I can help you, but you probably won't like the answer.
Technically, you can respond to a click in the native contacts application, by having an intent filter that catches the outgoing intent from "contacts". The problem is that the Contacts app doesn't publish the names of the outgoing Intents. You have to look for them yourself in the Android Open Source Project.
Also, you can't add anything that the Contacts app doesn't already do. The Contacts app doesn't support that.
You can write your own version of the Contacts app and provide the ability to attach any action you want.

Related

How does the native android contacts app cater for intents to apps, such as whatsapp

WhatsApp recently added the call feature. Before this, there was only one option when viewing a contact, that was to message the contact. Now there is the option to message or call a contact. Did WhatsApp add this entry to the ContactsContract, or did Google modify the contacts app to cater for WhatsApp? I am trying to make a custom contacts app, but I don't understand how to create links to apps from within this custom contacts app.
I have read this question,
How to get contacts which are used in whatsapp or other application in android
But the solution isn't generic enough. I want to make a contacts app that doesn't have the names of applications hard coded in.
An Android app can advertise in it's manifest it handles implicit intent for a given action (see Receiving an implicit intent). In this case, a dial action.
And to your practical question - you can use the PackageManager to query which Activities can handle an intent (in this case, an intent with ACTION_DIAL action), and use the PackageManager to get their name, icon, etc.
In WhatsApp case, you would like to know which contacts are WhatsApp users, but WhatsApp does not have an API or it's own ContentProvider. This 2014 blog post solution might be still valid, haven't checked.
Every app can only specify what type of uri scheme they can handle like sms:// or tel:// . For clearification, Apps cann't add entry of itself in some other apps.
In your Example case:
The Contact app itself implemented in such a way that it list all apps which can handle sms:// or tel:// type of uri scheme.
As the older version of WhatsApp can only handle sms:// uri scheme that's why Contact app only list SMS/message option. Also with calling feature in WhatsApp they added support for handling tel:// uri scheme that's why Contact app also shows the calling option.

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.

Integrate my app which contacts manager

I want to display my app's icon in the contact info as a shortcut. The same way as google+, fb, whatsapp does.
I found this question: Display the app icon if the contact is associated with the application in phone address book
And its very similar to what I want to do, but using Apache Cordova. Any ideas how can i do it?
I tried adding my app deeplink in contacts IMS using the contacts plugin, but no success so far.
Maybe this will help a bit. Give it a try!
This module is on my to-do list but i've kept it aside for a while...
I'll post if i'm able to do it. Please do the same!

Displaying contact details like android's native app

I am making an app that displays a list of people in a listview. When tapped, the app should transition to another screen displaying the contact details of that person loaded from a Person object i have retrieved from the DB. My question is how to display these details. In iOS, there was a ABUnknownPersonViewController that would mimic the native iOS addressbook entry to let me display the contact details in a clean and easy way. Is there anything similar for android that would let me use the People app's view or api to basically create and display a record exactly as android displays in its own People app?
your exact answer is contained here:
Open Contacts
The method described in the above link opens native contacts app and lets the user pick a contact. Then onActivityResult() comes into picture, here you can process the contact as per your requirement.
If you want to customize the look and feel you need to check here
You can retrieve the list and customize the UI.
If you just want to display a single contact's details. you can use this code. (contactId is the contactId of the contact that user picked)
Intent contactIntent = new Intent(Intent.ACTION_VIEW);
Uri uri = Uri.withAppendedPath(
ContactsContract.Contacts.CONTENT_URI,
String.valueOf(contactId));
contactIntent.setData(uri);
startActivity(contactIntent);
Hope this helps.
No. You can look through the AOSP and see if the contacts app was released as open source, and if so use it. But remember that the contact app on all phones isn't the same, Samsung for example uses several different apps of their own. And some people download their own contact apps. So its impossible to have the native feel for everyone, unless you launch the contact app via an intent.

Launch Android Default Email application through btn click

I posted this query here, but as usual, noone knows / no replies
http://www.anddev.org/viewtopic.php?p=41513#41513
How can I launch the android default mail application through the click of a button in my code?
I would also like to know, how this can be done to launch the contacts list also.
Any help in this regard is appreciated,
Regards,
Rony
How can I launch the android default mail application through the click of a button in my code?
Use an ACTION_SEND Intent.
(BTW, I apologize for the formatting of that blog post -- AndroidGuys keeps changing hosting providers, which screws up my posts)
I would also like to know, how this can be done to launch the contacts list also.
Use an ACTION_PICK Intent.

Categories

Resources