Sourcecode examples

How to use the Bar Code Reader

Please download the sample code here, or install the sample source code from the Add-on SDK.

How to capture images using the Front-Facing and Rear Camera

Please refer to this official Android documention which explains in detail how to detect and use a specific camera of Android devices.

How to capture Microphone and playback audio files on the speaker

You may use the Android Media Recorder to record audio and Android Media Player to playback audio.

How to detect if the cradle is connected to the device

Below sample code can be used to obtain a message when the device was plugged into the cradle or removed from it.

private static final String ETHERNET_STATE_CHANGED = "";
int event = intent.getIntExtra(ETH_STATE_INTENT, 0);

This code can also be found in the Add-on SDK.

array(35) { ["REDIRECT_STATUS"]=> string(3) "200" ["HTTP_USER_AGENT"]=> string(40) "CCBot/2.0 (" ["HTTP_ACCEPT"]=> string(63) "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8" ["HTTP_ACCEPT_LANGUAGE"]=> string(14) "en-US,en;q=0.5" ["HTTP_IF_MODIFIED_SINCE"]=> string(29) "Wed, 19 Feb 2020 09:27:39 GMT" ["HTTP_ACCEPT_ENCODING"]=> string(7) "br,gzip" ["HTTP_HOST"]=> string(19) "" ["HTTP_CONNECTION"]=> string(10) "Keep-Alive" ["PATH"]=> string(29) "/sbin:/usr/sbin:/bin:/usr/bin" ["LD_LIBRARY_PATH"]=> string(18) "/srv/httpd-mpm/lib" ["SERVER_SIGNATURE"]=> string(0) "" ["SERVER_SOFTWARE"]=> string(6) "Apache" ["SERVER_NAME"]=> string(19) "" ["SERVER_ADDR"]=> string(12) "" ["SERVER_PORT"]=> string(2) "80" ["REMOTE_ADDR"]=> string(14) "" ["DOCUMENT_ROOT"]=> string(38) "/data/sites/developer-website/frontend" ["REQUEST_SCHEME"]=> string(4) "http" ["CONTEXT_PREFIX"]=> string(0) "" ["CONTEXT_DOCUMENT_ROOT"]=> string(38) "/data/sites/developer-website/frontend" ["SERVER_ADMIN"]=> string(20) "" ["SCRIPT_FILENAME"]=> string(48) "/data/sites/developer-website/frontend/index.php" ["REMOTE_PORT"]=> string(5) "52362" ["REDIRECT_URL"]=> string(13) "/example-code" ["GATEWAY_INTERFACE"]=> string(7) "CGI/1.1" ["SERVER_PROTOCOL"]=> string(8) "HTTP/1.1" ["REQUEST_METHOD"]=> string(3) "GET" ["QUERY_STRING"]=> string(0) "" ["REQUEST_URI"]=> string(13) "/example-code" ["SCRIPT_NAME"]=> string(10) "/index.php" ["PATH_INFO"]=> string(13) "/example-code" ["PATH_TRANSLATED"]=> string(32) "redirect:/index.php/example-code" ["PHP_SELF"]=> string(23) "/index.php/example-code" ["REQUEST_TIME_FLOAT"]=> float(1593882478.181) ["REQUEST_TIME"]=> int(1593882478) }