0

I have to store a single authentication string(shared preference) inside content provider so that I can use that authentication sting by one more different application.

I found so many examples for SQLite database with the content provider but in my case table is not needed.

can anyone please help me how to store a simple string in content provider and get it by other app.

Thank you

Piyush Bansal
  • 1,635
  • 4
  • 16
  • 39
Usha
  • 74
  • 1
  • 10
  • Using SQLite or maybe a world readable share preference are the two options which come to mind ([see here](https://stackoverflow.com/questions/6030321/android-retrieving-shared-preferences-of-other-application)). – Tim Biegeleisen Sep 17 '18 at 06:48

1 Answers1

0

you might want to check out this answer

Shared preferences are one way to go about it . You see when you set a preference you can choose the option of making it readable by other app . This is how you can set a shared pref in one app and access it in another , I would provide code but the answer i have tagged is exactly what I would do. Also I dont know your specific case but sqlite for just this purpose will add alot of headache . Even if you decide to go for that you shopuld check out room database here

  • Context.MODE_WORLD_READABLE is for global data access, i don't want to make string value available for all other apps. – Usha Sep 17 '18 at 07:25