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 = "android.net.ethernet.ETHERNET_STATE_CHANGED";
intentFilter.addAction(ETHERNET_STATE_CHANGED);
int event = intent.getIntExtra(ETH_STATE_INTENT, 0);

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



array(33) { ["REDIRECT_STATUS"]=> string(3) "200" ["HTTP_HOST"]=> string(19) "miowork-dev.mio.com" ["HTTP_ACCEPT_ENCODING"]=> string(21) "x-gzip, gzip, deflate" ["HTTP_USER_AGENT"]=> string(39) "CCBot/2.0 (http://commoncrawl.org/faq/)" ["HTTP_ACCEPT"]=> string(63) "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8" ["HTTP_IF_MODIFIED_SINCE"]=> string(29) "Thu, 21 Sep 2017 06:42:30 GMT" ["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) "miowork-dev.mio.com" ["SERVER_ADDR"]=> string(12) "172.16.1.123" ["SERVER_PORT"]=> string(2) "80" ["REMOTE_ADDR"]=> string(14) "54.162.139.105" ["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) "tom@heek-nienborg.de" ["SCRIPT_FILENAME"]=> string(48) "/data/sites/developer-website/frontend/index.php" ["REMOTE_PORT"]=> string(5) "58244" ["REDIRECT_URL"]=> string(13) "/example-code" ["GATEWAY_INTERFACE"]=> string(7) "CGI/1.1" ["SERVER_PROTOCOL"]=> string(8) "HTTP/1.0" ["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(1511032916.818) ["REQUEST_TIME"]=> int(1511032916) }