Example usage for android.provider DocumentsContract PROVIDER_INTERFACE

List of usage examples for android.provider DocumentsContract PROVIDER_INTERFACE

Introduction

In this page you can find the example usage for android.provider DocumentsContract PROVIDER_INTERFACE.

Prototype

String PROVIDER_INTERFACE

To view the source code for android.provider DocumentsContract PROVIDER_INTERFACE.

Click Source Link

Document

Intent action used to identify DocumentsProvider instances.

Usage

From source file:com.activiti.android.platform.provider.transfer.ContentTransferManager.java

private static void isMediaProviderSupported(Context context) {
    final PackageManager pm = context.getPackageManager();
    // Pick up provider with action string
    final Intent i = new Intent(DocumentsContract.PROVIDER_INTERFACE);
    final List<ResolveInfo> providers = pm.queryIntentContentProviders(i, 0);
    for (ResolveInfo info : providers) {
        if (info != null && info.providerInfo != null) {
            final String authority = info.providerInfo.authority;
            isMediaDocumentProvider(Uri.parse("content://" + authority));
        }/*from w ww. j av a2s  . c  o  m*/
    }
}

From source file:cn.edu.wyu.documentviewer.RecentsProvider.java

@Override
public Bundle call(String method, String arg, Bundle extras) {
    if (METHOD_PURGE.equals(method)) {
        // Purge references to unknown authorities
        final Intent intent = new Intent(DocumentsContract.PROVIDER_INTERFACE);
        final Set<String> knownAuth = Sets.newHashSet();
        for (ResolveInfo info : getContext().getPackageManager().queryIntentContentProviders(intent, 0)) {
            knownAuth.add(info.providerInfo.authority);
        }/*from  w  w  w.j  av  a2 s .  c  o  m*/

        purgeByAuthority(new Predicate<String>() {
            @Override
            public boolean apply(String authority) {
                // Purge unknown authorities
                return !knownAuth.contains(authority);
            }
        });

        return null;

    } else if (METHOD_PURGE_PACKAGE.equals(method)) {
        // Purge references to authorities in given package
        final Intent intent = new Intent(DocumentsContract.PROVIDER_INTERFACE);
        intent.setPackage(arg);
        final Set<String> packageAuth = Sets.newHashSet();
        for (ResolveInfo info : getContext().getPackageManager().queryIntentContentProviders(intent, 0)) {
            packageAuth.add(info.providerInfo.authority);
        }

        if (!packageAuth.isEmpty()) {
            purgeByAuthority(new Predicate<String>() {
                @Override
                public boolean apply(String authority) {
                    // Purge authority matches
                    return packageAuth.contains(authority);
                }
            });
        }

        return null;

    } else {
        return super.call(method, arg, extras);
    }
}