0

i'm about to create a set of tools for android. That tools needed to track a group of people, one app for observing weight loss, other for controlling fitness activities of the same people etc. I think the most productive way to do that - using same database for all apps, i guess using content provider over db is good idea. Is there a common way to do such of things?

What about making dummy application for db and content provider and installing it as a dependency when one of that tools will run first time?

PS sorry for my Englishmy imagination

1 Answers1

1

1) If you install the content provider with one of your apps, the user could try to install the second app (without the provider) first. You have no control over that. And if the user uninstalls the app with the content provider, the other apps would be useless.

2) You can't put the provider in all the apps, because you cannot have a several apps installing a content provider with the same Authority.

3) You can install the Content Provider as a separate app:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="org.example.cntntprvdr"
    android:versionCode="1"
    android:versionName="1.0" >
    <application >
        <provider
            android:name="org.example.cntntprvdr.BookProvider"
            android:authorities="org.example.cntntprvdr.BookProvider" >      
        </provider>
    </application>
</manifest> 

Then the user can install the apps in the order they want, and can uninstall an app, and the other one would still access the content provider. An "advantage" of this may be that since the content provider doesn't have an app icon, is less likely that the user try to uninstall it. But still you have to ensure that the content provider is installed.

To be honest I haven't found a proper solution for this kind of situations, I'm talking about a google recommendation or best practices. What i've found is this --> https://stackoverflow.com/a/6786587/2017375 Which attempts to solve the scenario where you put the content provider in all of your apps. I haven't tested it, but you can give it a try.

Community
  • 1
  • 1
ILovemyPoncho
  • 2,762
  • 2
  • 24
  • 37
  • I decided to abandon this idea temporarily. But i found solution for content provider app. I can schedule special service in system alarm manager. This module will gather info about subscribed apps and, if no apps present in system it can advice user to backup data and ask for self destruction. I think android way is creation huge apps with bunch of tasks, rather then simple tools for exact objectives – Andrew Dementiev Jun 19 '14 at 01:56