[android-developers] Help with Content Providers / Content Resolvers

2011-01-10 Thread Pedro Duque
Hi,

I'm developing an editor for my application data. This application has a
free and a premium version, so each one has it's own content provider with
different authorities to avoid clashes. The editor also have a local content
provider so it can work standalone.

What I want to do is to check for a content provider existence when I start
the editor so I can choose to use the local one, the one from the free
application or the one from the premium application. I've search the
documentation but I can't find a way to list the content providers
available, for ex., for a specific MIME type.

Can somebody help me?

Regards,
PMD

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Help with Content Providers / Content Resolvers

2011-01-10 Thread Kostya Vasilyev
The mime type mapping works in the other direction: once you have a 
ContentProvider (or more specifically, a URI for a data query) it can be 
used to get the mime type.


For your task, take a look at:

http://developer.android.com/reference/android/content/pm/PackageManager.html#queryContentProviders(java.lang.String, 
int, int)


If both lite / pro versions share the same user id, you can try using 
that for the first parameter. If not, just filter the results by 
authority (since you know what you expect).


You can also use:

http://developer.android.com/reference/android/content/pm/PackageManager.html#getProviderInfo(android.content.ComponentName, 
int)


by calling it with the lite / pro authorities and checking the return value.

-- Kostya

10.01.2011 15:50, Pedro Duque пишет:

Hi,

I'm developing an editor for my application data. This application has 
a free and a premium version, so each one has it's own content 
provider with different authorities to avoid clashes. The editor also 
have a local content provider so it can work standalone.


What I want to do is to check for a content provider existence when I 
start the editor so I can choose to use the local one, the one from 
the free application or the one from the premium application. I've 
search the documentation but I can't find a way to list the content 
providers available, for ex., for a specific MIME type.


Can somebody help me?

Regards,
PMD
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en 



--
Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Help with Content Providers / Content Resolvers

2011-01-10 Thread Pedro Duque
Thank you Kostya, that's exactly what I was looking for!

On 10 January 2011 13:02, Kostya Vasilyev  wrote:

> The mime type mapping works in the other direction: once you have a
> ContentProvider (or more specifically, a URI for a data query) it can be
> used to get the mime type.
>
> For your task, take a look at:
>
>
> http://developer.android.com/reference/android/content/pm/PackageManager.html#queryContentProviders(java.lang.String,
> int, int)
>
> If both lite / pro versions share the same user id, you can try using that
> for the first parameter. If not, just filter the results by authority (since
> you know what you expect).
>
> You can also use:
>
>
> http://developer.android.com/reference/android/content/pm/PackageManager.html#getProviderInfo(android.content.ComponentName,
> int)
>
> by calling it with the lite / pro authorities and checking the return
> value.
>
> -- Kostya
>
> 10.01.2011 15:50, Pedro Duque пишет:
>
>> Hi,
>>
>> I'm developing an editor for my application data. This application has a
>> free and a premium version, so each one has it's own content provider with
>> different authorities to avoid clashes. The editor also have a local content
>> provider so it can work standalone.
>>
>> What I want to do is to check for a content provider existence when I
>> start the editor so I can choose to use the local one, the one from the free
>> application or the one from the premium application. I've search the
>> documentation but I can't find a way to list the content providers
>> available, for ex., for a specific MIME type.
>>
>> Can somebody help me?
>>
>> Regards,
>> PMD
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Android Developers" group.
>> To post to this group, send email to android-developers@googlegroups.com
>> To unsubscribe from this group, send email to
>> android-developers+unsubscr...@googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/android-developers?hl=en
>>
>
>
> --
> Kostya Vasilyev -- WiFi Manager + pretty widget --
> http://kmansoft.wordpress.com
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en