[android-developers] Re: What's the proper way to share data between lite and pro versions of the same app?

2009-04-27 Thread jarkman

I don't know if this is the *proper* way, exactly.

We copy the SQL data, with the Pro using the provider in the Lite to
read the data across and upgrade it.

And, we've built a cheap little scheme using broadcast intents to
allow the Pro to request the SharedPreferences from the Lite.

Hope that helps,

Richard


On Apr 27, 8:14 am, Just Checking eld...@gmail.com wrote:
 Suppose you have an app with a lite version and a full version. The
 app stores some user data in SharedPreferences, and some data in a SQL
 database.

 If a user tests the app for a few days, generating data all the time,
 and then decides to switch to the paid version, how do you copy or
 share the data between the two?

 Some code examples would be appreciated - but for some reason I have a
 feeling this is much, much more complex than I hope.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[android-developers] Re: What's the proper way to share data between lite and pro versions of the same app?

2009-04-27 Thread MrSnowflake

Iirc you can make the 2 version of the app use the same userId on the
phone, that way you have full access to the lite data from the pro
application.

On 27 apr, 10:56, jarkman jark...@gmail.com wrote:
 I don't know if this is the *proper* way, exactly.

 We copy the SQL data, with the Pro using the provider in the Lite to
 read the data across and upgrade it.

 And, we've built a cheap little scheme using broadcast intents to
 allow the Pro to request the SharedPreferences from the Lite.

 Hope that helps,

 Richard

 On Apr 27, 8:14 am, Just Checking eld...@gmail.com wrote:



  Suppose you have an app with a lite version and a full version. The
  app stores some user data in SharedPreferences, and some data in a SQL
  database.

  If a user tests the app for a few days, generating data all the time,
  and then decides to switch to the paid version, how do you copy or
  share the data between the two?

  Some code examples would be appreciated - but for some reason I have a
  feeling this is much, much more complex than I hope.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[android-developers] Re: What's the proper way to share data between lite and pro versions of the same app?

2009-04-27 Thread Just Checking

I tried that, and it didn't seem to work. In both manifests, I
specified:

android:sharedUserId=org.mydomain.projectname
But no luck.

From the documentation, I think the only thing it does is make the two
processes run under the same user ID, but you still have to do
something else to make one look at the other's data rather than create
its own. Perhaps something to do with contexts?

On Apr 27, 4:57 am, MrSnowflake mrsnowfl...@gmail.com wrote:
 Iirc you can make the 2 version of the app use the same userId on the
 phone, that way you have full access to the lite data from the pro
 application.

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[android-developers] Re: What's the proper way to share data between lite and pro versions of the same app?

2009-04-27 Thread Michael MacDonald
You have to specify the full path when opening the SQL database, instead
of using the helper that derives it from the context.


Just Checking wrote:
 I tried that, and it didn't seem to work. In both manifests, I
 specified:

 android:sharedUserId=org.mydomain.projectname
 But no luck.

 From the documentation, I think the only thing it does is make the two
 processes run under the same user ID, but you still have to do
 something else to make one look at the other's data rather than create
 its own. Perhaps something to do with contexts?

 On Apr 27, 4:57 am, MrSnowflake mrsnowfl...@gmail.com wrote:
   
 Iirc you can make the 2 version of the app use the same userId on the
 phone, that way you have full access to the lite data from the pro
 application.
 




--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[android-developers] Re: What's the proper way to share data between lite and pro versions of the same app?

2009-04-27 Thread Dianne Hackborn
Don't specify the full path, just use Context.createPackageContext() to
create a Context for the other package, and then use the data access APIs
from there.

Absolute paths: bad bad bad.

On Mon, Apr 27, 2009 at 8:43 AM, Michael MacDonald 
googlec...@antlersoft.com wrote:

  You have to specify the full path when opening the SQL database, instead
 of using the helper that derives it from the context.



 Just Checking wrote:

 I tried that, and it didn't seem to work. In both manifests, I
 specified:

 android:sharedUserId=org.mydomain.projectname
 But no luck.

 From the documentation, I think the only thing it does is make the two
 processes run under the same user ID, but you still have to do
 something else to make one look at the other's data rather than create
 its own. Perhaps something to do with contexts?

 On Apr 27, 4:57 am, MrSnowflake mrsnowfl...@gmail.com 
 mrsnowfl...@gmail.com wrote:


  Iirc you can make the 2 version of the app use the same userId on the
 phone, that way you have full access to the lite data from the pro
 application.




 



-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[android-developers] Re: What's the proper way to share data between lite and pro versions of the same app?

2009-04-27 Thread Just Checking

Dianne, Thank you. That worked like a charm.

The first time the app runs - onCreating the database - I try to get a
context from the other version, and if it exists I basically copy all
the databasebase tables. The same context gets me the other version's
shared preferences.

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---