0

I published my app on Android Market a long time ago and now I want to change the sharedUserId so it can share data with my other app. If I simply change it, the new version cannot read files created by the old version. The only ways I can think of to get around problem this are all cumbersome and error-prone. Using the SD card as temporary storage has several pitfalls and I cannot change the file permissions because my app uses the 2.1 SDK.

Does anyone know a (simple and reliable) way to handle this problem?

Thanks in advance...

Community
  • 1
  • 1
Barry Fruitman
  • 12,316
  • 13
  • 72
  • 135

1 Answers1

1

I did not implemented what I'm going to propose but I think it is possible. Consider the following idea (if you implement it and publish your code it will be nice, cause I think that the problem is common).

So in the old version of application with the new update you can create a Content Provider that will share your private files. You can install the permission to this content provider with the level signature. After that in a new application you can query data that is stored into this content provider. Thus, you'll have two applications: one with the content provider and the second will just use this content provider to download (query) your data.

Good luck!

Yury
  • 20,618
  • 7
  • 58
  • 86
  • Two apps (with different package names) or two versions of the same app? If you mean the first, creating a new app will require my users to install a new app, which is unacceptable. If you mean two versions of the same app, the new version will overwrite the old version, so the ContentProvider will be gone too. – Barry Fruitman Feb 11 '12 at 00:47
  • No, I meant two programs. But in this case why do you need sharedUserId? – Yury Feb 11 '12 at 12:28
  • I thought of this and Inmates using it (it works) but it is one of the cumbersome methods I was referring to above because it is a lot less flexible than just sharing files. – Barry Fruitman Feb 11 '12 at 18:48
  • I think that they are almost equivalent methods. Sharing of two files means that you also have to change two applications (old and new). As I see the question is not so popular as it should be (because it is really interesting). But I'd really like to have more opinions for this problem. – Yury Feb 11 '12 at 23:12