Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add / remove/clear from shared prefs #98

Open
tir38 opened this issue May 3, 2023 · 4 comments
Open

Add / remove/clear from shared prefs #98

tir38 opened this issue May 3, 2023 · 4 comments
Labels
feature request New feature or request

Comments

@tir38
Copy link
Owner

tir38 commented May 3, 2023

Add a value to default shared preferences.

adb shell 'am broadcast -a org.example.app.sp.PUT --es key key_name --es value "hello world!"'

Remove a value to default shared preferences.

adb shell 'am broadcast -a org.example.app.sp.REMOVE --es key key_name'

Clear all default shared preferences.

adb shell 'am broadcast -a org.example.app.sp.CLEAR --es key key_name'

@tir38 tir38 added the feature request New feature or request label May 18, 2023
@tir38
Copy link
Owner Author

tir38 commented May 18, 2023

I need to confirm these even work. I've not seen much documentation on them

@tir38
Copy link
Owner Author

tir38 commented Apr 10, 2024

A good first step might be to list all shared pref files, and then optionally list their content.

adb shell
run-as $PACKAGE
ls -al /data/data/$PACKAGE/shared_prefs

@tir38
Copy link
Owner Author

tir38 commented May 30, 2024

none of these am broadcast commands work. I can manipulate/list files contents just fine within adb shell

@tir38
Copy link
Owner Author

tir38 commented Jun 3, 2024

I'm getting a bug today:

ax shared_prefs list com.example.beta.debug
Listing all shared prefs files for com.example.beta.debug:

run-as: couldn't stat /data/user/0/com.example.beta.debug: No such file or directory
ls: /data/data/com.example.beta.debug/shared_prefs: No such file or directory

Likely because device/ emulator wasn't fully booted. I should add a "is fully booted" check first

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant