I have couple of applications that implements some login logic. If lets say one application is logged to some_account@gmail.com I want that all of these applications be logged to some_account@gmail.com. If I logout I want to all application do the same. But I don't want to immediately do the same. Application itself can handle it, but it need to know if some other application is already logged in and if yes just log in for the same email address as this app. So I need to know what is the email address for which other app is logged. I need to store one string.
First I was thinking about SharedPreferences
, but this is rather bad idea because there are other options (and stackoverflow is full of bad example of SharedPreferences usage between processes). Despite it I tried this. Set up sharedUserId
on all apps, called createPackageContext
and eventually try to get preferences. But I cannot read from it. Always I got null, even if I used Context.Mode_WORLD_READABLE
- which is deprecated by the way.
Ok, lesson learned do not use SharedPreferences
for that (I suppose). But everything what I need now is to store single string somewhere where it could be read by other my apps.
Maybe I should use ContentProvider
? But seriously... for one string?
What is the other option? I am sure that for so simple operation I really don't need Service
or ContentProvider
, but I actually haven't got idea how to do that.