adb shell am start -S -n com.datalogic.scan2deploy/.MainActivity -e json-path /sdcard/File.json
Using a JSON file is actually not supported from the MainActivity, so this will not work.
adb shell am broadcast -a datalogic.scan2deploy.intent.action.START_SERVICE -n “com.datalogic.scan2deploy/.S2dServiceReceiver” --es encoding json --es json-path /sdcard/File.json
After placing a JSON at the specified location, I copy and pasted this command and it worked.
The most likely reason that this would not be working is if the UI of Scan2Deploy Agent is open.
To close the UI of Agent, press the square button on your navigation bar, find Agent and drag it up.
Or run adb shell pm clear com.datalogic.scan2deploy
Drew Hugentobler
L3 Mobile Computer Specialist Support Engineer
I would advise you to build the json file with Scan2Deploy Studio. It has the option to save as a json file. (Not that I see any mistakes in your file though)
I used the intent below:
adb shell am broadcast -a datalogic.scan2deploy.intent.action.START_SERVICE -n "com.datalogic.scan2deploy/.S2dServiceReceiver" --es json-path "sdcard/File.json"
Alternatively you can use this command that embeds the json file in your string:
am broadcast -a datalogic.scan2deploy.intent.action.START_SERVICE -n "com.datalogic.scan2deploy/.S2dServiceReceiver" --es encoding json --es data "{\"$schema\":\"https://raw.githubusercontent.com/datalogic/scan2deploy-android-schema/v1-22-0/schema.json\",\"network\":{\"essid\":\"SSID-Test\",\"mode\":\"wpa-psk\",\"mode-key\":\"Test1234\",\"ip-address\":\"192.16.2.10\",\"ip-prefix-length\":24,\"ip-gateway\":\"192.16.2.1\",\"ip-dns1\":\"8.8.8.8\",\"ip-dns2\":\"8.8.4.4\",\"purge\":false}}"
(use the copy to JSON data (no whitespace)
Let us know if it works! Make sure as Drew said that the Scan2Deploy agent is not running on your device before sending the intent.