Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

sharedUserId: safe to change when app is already in market?

For the next version of our application, I want to change the sharedUserId since we now use an internal control dashboard app which must write to the other app's settings files.

But since the app is already installed on many phones, will this be a problem? I ran a little test on the emulator, and I'm seeing exceptions in the device logs that *.bak versions of the preference files cannot be written. Not sure how critical that is. Curiously, safing settings still seems to work, even though the shared_prefs folder had been created using another Linux user ID.

Did anyone try this before?

like image 526
Matthias Avatar asked Jul 15 '10 09:07

Matthias


2 Answers

And to answer my own question again:

No, it's not safe. Since updating an app via Android Market will not remove the database and preference files, the new version will not be able to read or write these files (since they were created under a different Linux user ID), and the app will crash after the update. You would have to ask your users to completely uninstall and reinstall the app, which is certainly not recommended.

As a general rule I conclude from this: Whenever you start out developing a new app, make sure to set a manual android:process and android:sharedUserId attribute! It doesn't hurt in case you don't need it, but it gives you full control over which apps have access to this app's private resources.

like image 117
Matthias Avatar answered Sep 27 '22 20:09

Matthias


No solution as of now, but starring at registered issues might get Google to fix this:

http://code.google.com/p/android/issues/detail?id=1227

http://code.google.com/p/android/issues/detail?id=14074

like image 24
3c71 Avatar answered Sep 27 '22 20:09

3c71