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(31) { ["REDIRECT_STATUS"]=> string(3) "200" ["HTTP_ACCEPT"]=> string(3) "*/*" ["HTTP_USER_AGENT"]=> string(9) "claudebot" ["HTTP_HOST"]=> string(19) "miowork-dev.mio.com" ["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.220" ["SERVER_PORT"]=> string(2) "80" ["REMOTE_ADDR"]=> string(12) "3.144.244.44" ["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) "58035" ["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(1713426297.21) ["REQUEST_TIME"]=> int(1713426297) }