Refer : http://lsit81.tistory.com/entry/Android-%EB%A3%A8%ED%8C%85-%EC%97%AC%EB%B6%80-%ED%99%95%EC%9D%B8%ED%95%98%EA%B8%B0
421121
public boolean checkRootingDevice() {
		boolean isRootingFlag = false;
		BufferedReader reader = null;
		try {
			Process process = Runtime.getRuntime().exec("find / -name su");

			reader = new BufferedReader(new InputStreamReader(
					process.getInputStream()));
			
			String result = reader.readLine();
			if (result == null) {
				Log.d(TAG, "Failed to execute find command to check if a file which is evidence of root exists");
				throw new RuntimeException("Unable to check if device is rooted");
			}
				
			if (result.contains("/su") == true) {
				isRootingFlag = true;
			}

		} catch (Exception e) {
			isRootingFlag = false;
		} finally {
			if (reader != null) {
				try {
					reader.close();
				} catch (IOException e) {
					Log.d(TAG, "Error occured while closing input stream");
				}
			}
		}

		if (!isRootingFlag) {
			isRootingFlag = checkRootingFiles(PLACES);
		}

		return isRootingFlag;
	}
1013715
function buildAndRun(args) {
  process.chdir(path.join(args.root, 'android'));
  const cmd = process.platform.startsWith('win')
    ? 'gradlew.bat'
    : './gradlew';

  const packageName = fs.readFileSync(
      'app/src/main/AndroidManifest.xml',
      'utf8'
    ).match(/package="(.+?)"/)[1];

  const adbPath = getAdbPath();
  if (args.deviceId) {
    if (isString(args.deviceId)) {
        runOnSpecificDevice(args, cmd, packageName, adbPath);
    } else {
      console.log(chalk.red('Argument missing for parameter --deviceId'));
    }
  } else {
    runOnAllDevices(args, cmd, packageName, adbPath);
  }
}
296644
function _isAndroid() {
    var /** @type {?} */ userAgent = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_5__angular_platform_browser__["b" /* ɵgetDOM */])() ? __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_5__angular_platform_browser__["b" /* ɵgetDOM */])().getUserAgent() : '';
    return /android (\d+)/.test(userAgent.toLowerCase());
}
852870
@TargetApi(Build.VERSION_CODES.KITKAT)
	// (http://stackoverflow.com/questions/19834842/android-gallery-on-kitkat-returns-different-uri-for-intent-action-get-content)
    @SuppressLint("NewApi")
	public static String getPath(final Context context, final Uri uri) {
        final boolean isKitKat = Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT;

        // DocumentProvider
        if(isKitKat && DocumentsContract.isDocumentUri(context, uri)) {
            // ExternalStorageProvider
            if(isExternalStorageDocument(uri)) {
                final String docId = DocumentsContract.getDocumentId(uri);
                final String[] split = docId.split(":");
                final String type = split[0];

                if("primary".equalsIgnoreCase(type)) {
                    return Environment.getExternalStorageDirectory() + "/" + split[1];
                }
            } else if(isDownloadsDocument(uri)) {
                final String id = DocumentsContract.getDocumentId(uri);
                if (!TextUtils.isEmpty(id)) {
                    return id.replace("raw:", "");
                }
                try {
                    final Uri contentUri = ContentUris.withAppendedId(
                            Uri.parse("content://downloads/public_downloads"), Long.valueOf(id));
                    return getDataColumn(context, contentUri, null, null);
                } catch (NumberFormatException e) {
                    Log.i(TAG,e.getMessage());
                    return null;
                }
            }
        } else if ("file".equalsIgnoreCase(uri.getScheme()) ||
                "content".equalsIgnoreCase(uri.getScheme())) {
            return uri.getPath();
        }

        return null;
    }
481726
private void installPackage() {
        AndPermission.with(this)
            .install()
            .file(new File(Environment.getExternalStorageDirectory(), "android.apk"))
            .rationale(new InstallRationale())
            .onGranted(new Action<File>() {
                @Override
                public void onAction(File data) {
                    // Installing.
                }
            })
            .onDenied(new Action<File>() {
                @Override
                public void onAction(File data) {
                    // The user refused to install.
                }
            })
            .start();
    }
1040063
@Override
  public String getMainActivity() throws AndroidSdkException {
    if (mainActivity == null) {
      try {
        mainActivity = extractApkDetails("launchable-activity: name='(.*?)'");
      } catch (ShellCommandException e) {
        throw new SelendroidException("The main activity of the apk " + apkFile.getName()
            + " cannot be extracted.");
      }
    }
    return mainActivity;
  }
666875
function escapeForIOSAndAndroid(args) {
  if (Platform.OS === 'android' || Platform.OS === 'ios') {
    return map(args, escapeBlob)
  } else {
    return args
  }
}
972605
protected function checkBrowserAndroidSamsungGalaxy() 
    {
	    if( stripos($this->_agent,'Android') !== false ) 
	    {
	        $this->setVersion(self::VERSION_UNKNOWN);
	        $this->setMobile(true);
	        
	    	if( stripos($this->_agent,'GT-I9000') !== false ) 
	    	{
    		    $this->setBrowser(self::BROWSER_GALAXY_S);
			    return true;
	    	}
	    	if( stripos($this->_agent,'GT-I9001') !== false ) 
	    	{
			    $this->setBrowser(self::BROWSER_GALAXY_S_PLUS);
			    return true;
	    	}
	    	if( stripos($this->_agent,'GT-I9100') !== false ) 
	    	{
			    $this->setBrowser(self::BROWSER_GALAXY_S_II);
			    return true;
	    	}
	    	if( stripos($this->_agent,'GT-I9300') !== false )
	    	{
	    	    $this->setBrowser(self::BROWSER_GALAXY_S_III);
	    	    return true;
	    	}
	    	if( stripos($this->_agent,'GT-I8190') !== false )
	    	{
	    	    $this->setBrowser(self::BROWSER_GALAXY_S_III_MINI);
	    	    return true;
	    	}
	    	if( stripos($this->_agent,'GT-I9301') !== false )
	    	{
	    	    $this->setBrowser(self::BROWSER_GALAXY_S_III_NEO);
	    	    return true;
	    	}
	    	//S4
	    	if( stripos($this->_agent,'GT-I9500') !== false ||
	    	    stripos($this->_agent,'GT-I9505') !== false ||
	    	    stripos($this->_agent,'GT-I9506') !== false ||
	    	    stripos($this->_agent,'GT-I9515') !== false  )
	    	{
	    	    $this->setBrowser(self::BROWSER_GALAXY_S4);
	    	    return true;
	    	}
	    	if( stripos($this->_agent,'GT-I9195') !== false )
	    	{
	    	    $this->setBrowser(self::BROWSER_GALAXY_S4_MINI);
	    	    return true;
	    	}
	    	if( stripos($this->_agent,'GT-I9295') !== false )
	    	{
	    	    $this->setBrowser(self::BROWSER_GALAXY_S4_ACTIVE);
	    	    return true;
	    	}
	    	if( stripos($this->_agent,'SM-C101') !== false )
	    	{
	    	    $this->setBrowser(self::BROWSER_GALAXY_S4_ZOOM);
	    	    return true;
	    	}
	    	//S5
	    	if( stripos($this->_agent,'SM-G900') !== false )
	    	{
	    	    $this->setBrowser(self::BROWSER_GALAXY_S5);
	    	    return true;
	    	}
	    	if( stripos($this->_agent,'SM-G800') !== false ) 
	    	{
	    	    $this->setBrowser(self::BROWSER_GALAXY_S5_MINI);
	    	    return true;
	    	}
	    	if( stripos($this->_agent,'SM-G870') !== false )
	    	{
	    	    $this->setBrowser(self::BROWSER_GALAXY_S5_ACTIVE);
	    	    return true;
	    	}
	    	if( stripos($this->_agent,'SM-C115') !== false )
	    	{
	    	    $this->setBrowser(self::BROWSER_GALAXY_S5_ZOOM);
	    	    return true;
	    	}
	    	//S6 
	    	if( stripos($this->_agent,'SM-G920') !== false )
	    	{
	    	    $this->setBrowser(self::BROWSER_GALAXY_S6);
	    	    return true;
	    	}
	    	if( stripos($this->_agent,'SM-G890') !== false )
	    	{
	    	    $this->setBrowser(self::BROWSER_GALAXY_S6_ACTIVE);
	    	    return true;
	    	}
	    	if( stripos($this->_agent,'SM-G9198') !== false )
	    	{
	    	    $this->setBrowser(self::BROWSER_GALAXY_S6_MINI);
	    	    return true;
	    	}
	    	if( stripos($this->_agent,'SM-G925') !== false )
	    	{
	    	    $this->setBrowser(self::BROWSER_GALAXY_S6_EDGE);
	    	    return true;
	    	}
	    	if( stripos($this->_agent,'SM-G928') !== false )
	    	{
	    	    $this->setBrowser(self::BROWSER_GALAXY_S6_EDGE_P);
	    	    return true;
	    	}
	    	
	    	
	    	if( stripos($this->_agent,'GT-S5830') !== false ) 
	    	{
			    $this->setBrowser(self::BROWSER_GALAXY_ACE);
			    return true;
	    	}
	    	if( stripos($this->_agent,'GT-I8160') !== false )
	    	{
	    	    $this->setBrowser(self::BROWSER_GALAXY_ACE_2);
	    	    return true;
	    	}
	    	if( stripos($this->_agent,'GT-S7500') !== false )
	    	{
	    	    $this->setBrowser(self::BROWSER_GALAXY_ACE_PLUS);
	    	    return true;
	    	}
	    	if( stripos($this->_agent,'GT-I9250') !== false ||
	    	    stripos($this->_agent,'Galaxy Nexus Build') !== false ) 
	    	{
	    	    $this->setBrowser(self::BROWSER_SAMSUNG_GALAXY_NEXUS);
	    	    return true;
	    	}
	    	if( stripos($this->_agent,'GT-N7000') !== false )
	    	{
	    	    $this->setBrowser(self::BROWSER_GALAXY_NOTE);
	    	    return true;
	    	}
	    	if( stripos($this->_agent,'GT-P1000') !== false ||
	    		stripos($this->_agent,'GT-P1010') !== false ||
	    		stripos($this->_agent,'GT-P7100') !== false ||
	    		stripos($this->_agent,'GT-P7300') !== false ||
	    		stripos($this->_agent,'GT-P7510') !== false ||
	    		stripos($this->_agent,'GT-P6200') !== false ||
	    		stripos($this->_agent,'GT-P6210') !== false )
	    	{
			    $this->setBrowser(self::BROWSER_GALAXY_TAB);
			    return true;
	    	}
	    }
	    return false;
    }
406274
function getAndroidJSInterface(oWebViewInterface){
    var AndroidWebViewInterface = com.shripalsoni.natiescriptwebviewinterface.WebViewInterface.extend({
        /**
         * On call from webView to android, this function is called from handleEventFromWebView method of WebViewInerface class
         */
        onWebViewEvent: function(webViewId, eventName, jsonData){
            // getting webviewInterface object by webViewId from static map.
            var oWebViewInterface = getWebViewIntefaceObjByWebViewId(webViewId);
            if (oWebViewInterface) {
                oWebViewInterface._onWebViewEvent(eventName, jsonData);
            }
        }
    });
    
    // creating androidWebViewInterface with unique web-view id.
    return new AndroidWebViewInterface(new java.lang.String(''+oWebViewInterface.id));
 }
690405
public long[] extractULongArray() throws DevFailed {
		manageExceptions("extractULong");
		if (use_union) {
	    	final int[] array = attributeValue_5.value.ulong_att_value();
	    	long mask = 0x7fffffff;
	    	mask += (long) 1 << 31;
	    	final long[] result = new long[array.length];
	    	for (int i = 0; i < array.length; i++) {
			result[i] = mask & array[i];
	    	}
	    	return result;
		} else {
	    	return deviceAttribute_3.extractULongArray();
		}
    }
521773
private int checkSelfPermission(Activity activity, String permission) {
    try {
      return androidPermissionService.checkSelfPermission(activity, permission);
    } catch (RuntimeException ignored) {
      return PackageManager.PERMISSION_DENIED;
    }
  }
1240726
final void install() {
        Intent intent = new Intent(Intent.ACTION_INSTALL_PACKAGE);
        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
        Uri uri = AndPermission.getFileUri(mSource.getContext(), mFile);
        intent.setDataAndType(uri, "application/vnd.android.package-archive");
        mSource.startActivity(intent);
    }
189335
def get_android_id(self) -> str:
        ''''''
        output, _ = self._execute(
            '-s', self.device_sn, 'shell', 'settings', 'get', 'secure', 'android_id')
        return output.strip()
829214
function updateBranchMetaData(manifest, preferences) {
    let metadatas = manifest.manifest.application[0]["meta-data"] || [];
    const metadata = [];
    const keys = ["io.branch.sdk.BranchKey", "io.branch.sdk.TestMode"];
    const vals = [
      preferences.branchKey,
      preferences.androidTestMode || "false"
    ];

    // remove old
    for (var i = 0; i < keys.length; i++) {
      metadatas = removeBasedOnAndroidName(metadatas, keys[i]);
    }

    // add new
    for (i = 0; i < keys.length; i++) {
      const key = keys[i];
      const val = vals[i];
      metadata.push({
        $: {
          "android:name": key,
          "android:value": val
        }
      });
    }
    manifest.manifest.application[0]["meta-data"] = metadatas.concat(metadata);

    return manifest;
  }
768900
function AndroidWakeLock() {
  var video = document.createElement('video');

  video.addEventListener('ended', function() {
    video.play();
  });

  this.request = function() {
    if (video.paused) {
      // Base64 version of videos_src/no-sleep-60s.webm.
      video.src = Util.base64('video/webm', 'GkXfowEAAAAAAAAfQoaBAUL3gQFC8oEEQvOBCEKChHdlYm1Ch4ECQoWBAhhTgGcBAAAAAAAH4xFNm3RALE27i1OrhBVJqWZTrIHfTbuMU6uEFlSua1OsggEwTbuMU6uEHFO7a1OsggfG7AEAAAAAAACkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmAQAAAAAAAEUq17GDD0JATYCNTGF2ZjU2LjQwLjEwMVdBjUxhdmY1Ni40MC4xMDFzpJAGSJTMbsLpDt/ySkipgX1fRImIQO1MAAAAAAAWVK5rAQAAAAAAADuuAQAAAAAAADLXgQFzxYEBnIEAIrWcg3VuZIaFVl9WUDmDgQEj44OEO5rKAOABAAAAAAAABrCBsLqBkB9DtnUBAAAAAAAAo+eBAKOmgQAAgKJJg0IAAV4BHsAHBIODCoAACmH2MAAAZxgz4dPSTFi5JACjloED6ACmAECSnABMQAADYAAAWi0quoCjloEH0ACmAECSnABNwAADYAAAWi0quoCjloELuACmAECSnABNgAADYAAAWi0quoCjloEPoACmAECSnABNYAADYAAAWi0quoCjloETiACmAECSnABNIAADYAAAWi0quoAfQ7Z1AQAAAAAAAJTnghdwo5aBAAAApgBAkpwATOAAA2AAAFotKrqAo5aBA+gApgBAkpwATMAAA2AAAFotKrqAo5aBB9AApgBAkpwATIAAA2AAAFotKrqAo5aBC7gApgBAkpwATEAAA2AAAFotKrqAo5aBD6AApgDAkpwAQ2AAA2AAAFotKrqAo5aBE4gApgBAkpwATCAAA2AAAFotKrqAH0O2dQEAAAAAAACU54Iu4KOWgQAAAKYAQJKcAEvAAANgAABaLSq6gKOWgQPoAKYAQJKcAEtgAANgAABaLSq6gKOWgQfQAKYAQJKcAEsAAANgAABaLSq6gKOWgQu4AKYAQJKcAEqAAANgAABaLSq6gKOWgQ+gAKYAQJKcAEogAANgAABaLSq6gKOWgROIAKYAQJKcAEnAAANgAABaLSq6gB9DtnUBAAAAAAAAlOeCRlCjloEAAACmAECSnABJgAADYAAAWi0quoCjloED6ACmAECSnABJIAADYAAAWi0quoCjloEH0ACmAMCSnABDYAADYAAAWi0quoCjloELuACmAECSnABI4AADYAAAWi0quoCjloEPoACmAECSnABIoAADYAAAWi0quoCjloETiACmAECSnABIYAADYAAAWi0quoAfQ7Z1AQAAAAAAAJTngl3Ao5aBAAAApgBAkpwASCAAA2AAAFotKrqAo5aBA+gApgBAkpwASAAAA2AAAFotKrqAo5aBB9AApgBAkpwAR8AAA2AAAFotKrqAo5aBC7gApgBAkpwAR4AAA2AAAFotKrqAo5aBD6AApgBAkpwAR2AAA2AAAFotKrqAo5aBE4gApgBAkpwARyAAA2AAAFotKrqAH0O2dQEAAAAAAACU54J1MKOWgQAAAKYAwJKcAENgAANgAABaLSq6gKOWgQPoAKYAQJKcAEbgAANgAABaLSq6gKOWgQfQAKYAQJKcAEagAANgAABaLSq6gKOWgQu4AKYAQJKcAEaAAANgAABaLSq6gKOWgQ+gAKYAQJKcAEZAAANgAABaLSq6gKOWgROIAKYAQJKcAEYAAANgAABaLSq6gB9DtnUBAAAAAAAAlOeCjKCjloEAAACmAECSnABF4AADYAAAWi0quoCjloED6ACmAECSnABFwAADYAAAWi0quoCjloEH0ACmAECSnABFoAADYAAAWi0quoCjloELuACmAECSnABFgAADYAAAWi0quoCjloEPoACmAMCSnABDYAADYAAAWi0quoCjloETiACmAECSnABFYAADYAAAWi0quoAfQ7Z1AQAAAAAAAJTngqQQo5aBAAAApgBAkpwARUAAA2AAAFotKrqAo5aBA+gApgBAkpwARSAAA2AAAFotKrqAo5aBB9AApgBAkpwARQAAA2AAAFotKrqAo5aBC7gApgBAkpwARQAAA2AAAFotKrqAo5aBD6AApgBAkpwAROAAA2AAAFotKrqAo5aBE4gApgBAkpwARMAAA2AAAFotKrqAH0O2dQEAAAAAAACU54K7gKOWgQAAAKYAQJKcAESgAANgAABaLSq6gKOWgQPoAKYAQJKcAESAAANgAABaLSq6gKOWgQfQAKYAwJKcAENgAANgAABaLSq6gKOWgQu4AKYAQJKcAERgAANgAABaLSq6gKOWgQ+gAKYAQJKcAERAAANgAABaLSq6gKOWgROIAKYAQJKcAEQgAANgAABaLSq6gB9DtnUBAAAAAAAAlOeC0vCjloEAAACmAECSnABEIAADYAAAWi0quoCjloED6ACmAECSnABEAAADYAAAWi0quoCjloEH0ACmAECSnABD4AADYAAAWi0quoCjloELuACmAECSnABDwAADYAAAWi0quoCjloEPoACmAECSnABDoAADYAAAWi0quoCjloETiACmAECSnABDgAADYAAAWi0quoAcU7trAQAAAAAAABG7j7OBALeK94EB8YIBd/CBAw==');
      video.play();
    }
  };

  this.release = function() {
    video.pause();
    video.src = '';
  };
}
909046
def scan_activity
      r = execute(make_xml('ScanActivityRequest'))
      res = []
      if r.success
        r.res.elements.each('//ScanSummary') do |scan|
          res << ScanSummary.parse(scan)
        end
      end
      res
    end
1245838
def android_example():
    """"""
    env = holodeck.make("AndroidPlayground")

    # The Android's command is a 94 length vector representing torques to be applied at each of his joints
    command = np.ones(94) * 10
    for i in range(10):
        env.reset()
        for j in range(1000):
            if j % 50 == 0:
                command *= -1

            state, reward, terminal, _ = env.step(command)

            # To access specific sensor data:
            pixels = state[Sensors.PIXEL_CAMERA]
            orientation = state[Sensors.ORIENTATION_SENSOR]