Code example for Context

Methods: getPackageName, revokeUriPermission

0
        return Uri.parse(url);
    } 
     
    public static void revokeUriPermissions(Context ctx)
    { 
        String rootUri = PROTOCOL_PREFIX + '/' + ctx.getPackageName();
 
        Logger.I(TAG, "Revoke URI permissions: " + rootUri);
 
        ctx.revokeUriPermission(Uri.parse(rootUri), Intent.FLAG_GRANT_READ_URI_PERMISSION);
    } 
     
    public static File fileFromUri(Uri uri) throws IllegalArgumentException
    { 
        String authority = uri.getAuthority();
        if(isCorrectAuthority(authority))
            return new File(PATH_PREFIX + authority + uri.getPath());
        else throw new IllegalArgumentException("Unknown URI authority: " + authority);
    } 
     
    @Override