Java Code Examples for com.android.contacts.util.ImplicitIntentsUtil

Following code examples demonstrate how to use com.android.contacts.util.ImplicitIntentsUtilfrom android. These examples are extracted from various highly rated open source projects. You can directly use these code snippets or view their entire linked source code. These snippets are extracted to provide contextual information about how to use this class in the real world. These samples also let you understand some good practices on how to use com.android.contacts.util.ImplicitIntentsUtiland various code implementation of this class.

    public void onReceive(Context context, Intent intent) {
        final Uri dataUri = intent.getData();
        final Intent newIntent = new Intent(QuickContact.ACTION_QUICK_CONTACT);
        newIntent.setSourceBounds(intent.getSourceBounds());
        newIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
        newIntent.setData(dataUri);
        ImplicitIntentsUtil.startActivityInApp(context, newIntent);
    } 


Advertisement
Javadoc
Utility for forcing intents to be started inside the current app. This is useful for avoiding sensel

ess disambiguation dialogs. Ie, if a user clicks a contact inside Contacts we assume they want to view the contact inside the Contacts app as opposed to a 3rd party contacts app. Methods are designed to replace the use of startActivity() for implicit intents. This class isn't necessary for explicit intents. No attempt is made to replace startActivityForResult(), since startActivityForResult() is always used with explicit intents in this project. Why not just always use explicit intents? The Contacts/Dialer app implements standard intent actions used by others apps. We want to continue exercising these intent filters to make sure they still work. Plus we sometimes don't know an explicit intent would work. See #startActivityInAppIfPossible. Some ContactsCommon code that is only used by Dialer doesn't use ImplicitIntentsUtil.

Read More
Advertisement