There is a command to start an activity based on intent: am start
. Also to send a broadcast: am broadcast
.
I think probably there should be a shell command to query a content provider, probably something like:
query content://com.myapp.authority/path --where 'column=?' --arg 1 --order 'column desc'
or similar.
Is there one?
Open a command window in the folder by holding shift and right-clicking in an empty spot in the folder and selecting "Open command prompt/PowerShell here" in the menu. Then you can start using ADB — connect your phone and try . ADB devices to see if it's working. A list with attached devices should show up.
To use ADB with your Android device, you must enable a feature called “USB Debugging.” Open your phone's app drawer, tap the Settings icon, and select “About Phone”. Scroll all the way down and tap the “Build Number” item seven times. You should get a message saying you are now a developer.
From Xamarin Studio, go to Tools, then select "Open Android SDK Command Prompt". This will open a terminal window and automatically navigate you to the Android SDK location. From there you can use the ADB command.
Android Debug Bridge (adb) is a versatile command-line tool that lets you communicate with a device. The adb command facilitates a variety of device actions, such as installing and debugging apps, and it provides access to a Unix shell that you can use to run a variety of commands on a device.
There is a content
command:
usage: adb shell content [subcommand] [options] usage: adb shell content insert --uri <URI> [--user <USER_ID>] --bind <BINDING> [--bind <BINDING>...] <URI> a content provider URI. <BINDING> binds a typed value to a column and is formatted: <COLUMN_NAME>:<TYPE>:<COLUMN_VALUE> where: <TYPE> specifies data type such as: b - boolean, s - string, i - integer, l - long, f - float, d - double Note: Omit the value for passing an empty string, e.g column:s: Example: # Add "new_setting" secure setting with value "new_value". adb shell content insert --uri content://settings/secure --bind name:s:new_setting --bind value:s:new_value usage: adb shell content update --uri <URI> [--user <USER_ID>] [--where <WHERE>] <WHERE> is a SQL style where clause in quotes (You have to escape single quotes - see example below). Example: # Change "new_setting" secure setting to "newer_value". adb shell content update --uri content://settings/secure --bind value:s:newer_value --where "name='new_setting'" usage: adb shell content delete --uri <URI> [--user <USER_ID>] --bind <BINDING> [--bind <BINDING>...] [--where <WHERE>] Example: # Remove "new_setting" secure setting. adb shell content delete --uri content://settings/secure --where "name='new_setting'" usage: adb shell content query --uri <URI> [--user <USER_ID>] [--projection <PROJECTION>] [--where <WHERE>] [--sort <SORT_ORDER>] <PROJECTION> is a list of colon separated column names and is formatted: <COLUMN_NAME>[:<COLUMN_NAME>...] <SORT_ORDER> is the order in which rows in the result should be sorted. Example: # Select "name" and "value" columns from secure settings where "name" is equal to "new_setting" and sort the result by name in ascending order. adb shell content query --uri content://settings/secure --projection name:value --where "name='new_setting'" --sort "name ASC" usage: adb shell content call --uri <URI> --method <METHOD> [--arg <ARG>] [--extra <BINDING> ...] <METHOD> is the name of a provider-defined method <ARG> is an optional string argument <BINDING> is like --bind above, typed data of the form <KEY>:{b,s,i,l,f,d}:<VAL>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With