1

I am making an android application in which I have to save image names in shared preferences via string format.

I am able to see my shared preference xml file in Android Device Monitor but I want to see it in my real android device. I have searched in android device local data neither I am seeing my application package name nor xml file anywhere during debugging.

Please help me why I can't see my application package in mobile device during debugging.

Sebi
  • 3,879
  • 2
  • 35
  • 62
Mohammad Aamir
  • 471
  • 2
  • 5
  • 14

2 Answers2

1

SharedPreferences are stored in an xml file in the app data folder, i.e. /data/data/YOUR_PACKAGE_NAME/shared_prefs/YOUR_PREFS_NAME.xml

or the default preferences at: /data/data/YOUR_PACKAGE_NAME/shared_prefs/YOUR_PACKAGE_NAME_preferences.xml

from this Answer

However, you can also use Stetho to access your sharedpreferences in debug mode. ie you can view sharedPreferences from your chrome browser.

Stetho can :

  • view and edit SharedPreferences
  • view and edit sqlite db
  • monitor network requests enter image description here
Community
  • 1
  • 1
OBX
  • 6,044
  • 7
  • 33
  • 77
0

You will need to have root permission to see the sharedpreferences of your app in real device,

Steps

1.Root your phone(for rooting phone i would suggest kingo root mobile app)

2.install Root browser/Root explorer app

3.go to folder data-->data-->your packagename-->shared_prefs-->your shared prefs name

Manohar
  • 22,116
  • 9
  • 108
  • 144
  • It's possible to access private files via `adb` for debuggable applications with `run-as ` command (without root access). Like in this answer: https://stackoverflow.com/questions/2811615/how-to-access-the-database-when-developing-on-android-phone/8433520#8433520 – Kirill Feb 08 '17 at 07:03