I am automating the Android app using appium and i have a scenario which need to be verified on both Fringerprint available and not available devices.
To get the devices details like device OS version, name etc. i am using the adb shell command like
adb shell getprop ro.build.version.release
like this i tried to get the props for fingerprint enabled device and i got the below props which are related to fingerprint
[ro.bootimage.build.fingerprint]: [google/angler/angler:7.1.2/N2G47O/3852959:user/release-keys]
[ro.vendor.build.fingerprint]: [google/angler/angler:7.1.2/N2G47O/3852959:user/release-keys]
[init.svc.fingerprintd]: [running]
And now need to know which is the right property to check
Is Fingerprint option available
Is Fingerprint setting is enabled (i mean atleast one finger added or not)
The first two properties you are listing [ro.bootimage.build.fingerprint] and [ro.vendor.build.fingerprint] are not related to a fingerprint reader device, but to the cryptographic fingerprint of the Android disk image for the boot partition (ro.bootimage) and vendor-specific software partition (ro.vendor).
The property [init.svc.fingerprintd] tells you the current state (running) of the fingerprint daemon (fingerprintd) service (svc). This service is needed to enroll fingerprints and perform other operations (see https://source.android.com/security/authentication/fingerprint-hal).
So you need to look elsewhere for a way to check if the fingerprint option is available and set. The FingerprintManager API has a public method hasEnrolledFingerprints() which can be used to determine if there is at least one fingerprint enrolled. You can call this API this from within an app.
From an adb shell, you might have to call the fingerprintd service directly instead of using the API (Use Android API functions with ADB).
To get the unique device fingerprint, use the following adb command
adb shell getprop ro.build.fingerprint
Related
I am trying to set the Settings.Global.PACKAGE_VERIFIER_ENABLE value in Android by using
Settings.Global.putInt(mContext.getContentResolver(),key,value);
However, what ever value I set , I was not getting the value when do following adb command.
adb shell settings get global package_verifier_enable
Thanks InAdvance
in the official android documentation is described that
Applications can read these but are not allowed to write; like the "Secure" settings, these are for preferences that the user must explicitly modify through the system UI or specialized APIs for those values.
This means that unless your app is running as system you're not allowed to write to those settings.
If you have the right signing certificate for the android operating system that you're using, you can sign your app to run with system privileges. As long as you're just running as a "normal" app there is no way to modify these settings.
You can however (which is bad practice) use su to set this setting via
su -c 'settings set global package_verifier_enable 0'
I'm working on a non phone device that run Android 2.3.3. We have a custom Android version (with some additionnal driver) and my application has "system" privileges since we build our apps with the same key used to build android.
I had unlocked full Android API (including com.android.internal.*) following this post : https://devmaze.wordpress.com/2011/01/18/using-com-android-internal-part-1-introduction/.
I deleted the Phone.apk from the device to ensure that no process is using rild.
I can instanciate a GSMPhone from my app, but after, I'm unable to execute any commands like supplyPin or getImei. I always have the same error :
CommandException: RADIO_NOT_AVAILABLE.
I'm really stuck here, any help would be precious.
CommandException: RADIO_NOT_AVAILABLE indicates that the rild socket is not opened. In other words, the rild service is not attached to the underlying basebane/modem you are using.
Run ps in adb shell to check if rild service is in the list. If it is in the list, run ls -l /dev/tty* and check if the modem device attached with the Android platform exists here or not. If it does not exist, it means that the Kernel is unable to enumerate your modem device and you need to add support in kernel for it. If it exists, run adb logcat -b radio and check the radio logs output which would really be helpful to diagnose the issue further.
adb shell ps | grep rild to check if RILD is in runing.
Since you can access all the api, do some initialization like PhoneApp do in Phone application OnCreate(mostly like setting params to modem, set radio power which will power on/off the modem, etc)
How can you access the KNOX counter programmatically from the android SDK?
I would like my app to check the value to try and ascertain if it is running on a samsung phone that has been rooted.
I just decompiled KNOX Status. It looks like all the app is doing is getting the system property ro.boot.warranty_bit. I'm not sure if this still works and I don't have a Samsung at the moment to test.
In terminal run:
adb shell getprop ro.boot.warranty_bit
If the result is 0, then the warranty should be valid. You can use this class to get the system property in an Android app.
There are command line flags (or "switches") that Chromium (and Chrome) accept in order to enable particular features or modify otherwise default functionality.
Chromium Command Line Switches
Run Chromium with flags
Tried Chrome 41.0.xx and Chromium 43.0.xxx shell with:
# echo "chrome <flags>" > /data/local/tmp/android-webview-command-line
# echo "chrome <flags>" > /data/local/tmp/content-shell-command-line
Any idea how to run chrome with flags on Android or directly add these into default profile.
Want to add --sync-url flag to use my sync server instead of google sync servers. chrome://flags only enable/disable flags but wont let you add new flag.
New method added in Chrome 661 that works for a production build on unrooted devices.
Using adb, write the flags to /data/local/tmp/chrome-command-line.
For example:
~$ adb shell 'echo --unsafely-treat-insecure-origin-as-secure=http://a.test > /data/local/tmp/chrome-command-line'
In chrome://flags, turn on enable-command-line-on-non-rooted-devices.
Force stop Chrome (the relaunch now button will not trigger the reading of the flags file, even though the danger snackbar will disagree).
Verify in chrome://version that this worked.
https://www.chromium.org/developers/how-tos/run-chromium-with-flags#TOC-Android
What you're doing is correct, but seems like you're writing the switches to the wrong file for Chrome (and note that the file that you write the switches to may vary based on the OS version [or maybe phone?] ).
I tried this on two different phones, and had to write to two different files! Hopefully one of them will work for you:
Phone 1: Nexus 6 with Android 6.0.1
Simply do the following in adb shell:
echo "chrome --sync-url" > /data/local/tmp/chrome-command-line'
Phone 2: MotoG with Android 4.4.4
This is a bit trickier. It turned out that Chrome actually reads the switches from /data/local/chrome-command-line (not in the tmp subdirectory!). Now the issue is that on an unrooted phone you won't have permission to write to this file! So I had to root my phone* and use su to write to the file:
adb shell
su
echo "chrome --sync-url" > /data/local/chrome-command-line
*Rooting an Android phone is actually very easy and takes only a few minutes. There are a number of one click apps for rooting your phone (e.g. KingoRoot). For the case of MotoG, I had to do a few more steps to root, following this)
I needed insecure origin flag for testing of service workers on mobile device. However, for some reason these flags did not work on mobile chrome. Behaviour similar to insecure origin flag can be achieved by port forwarding.
You can find further info in my original answer here: https://stackoverflow.com/a/56146180/5048121
This does not apply exclusively on service workers, if you need https behavior on mobile device, you can combine it for example with allow-insecure-localhost flag or use self-signed certificate for localhost on server and get rid of cert errors on mobile chrome.
You need chromium debug build in order to use these switches.
I've created a sample project using BackupRestore. I went to register for a key at Android Backup Service. I got the following:
Your key is:
AEdPqrEAAAAIW4p30C1GTNjzBOqWrb0clI7_OCWxm3ddIgkKhw
This key is good for the app with the package name:
com.example.android.backuprestore
Provide this key in your AndroidManifest.xml file with the following element,
placed inside the <application> element:
<meta-data android:name="com.google.android.backup.api_key"
android:value="AEdPqrEAAAAIW4p30C1GTNjzBOqWrb0clI7_OCWxm3ddIgkKhw" />
When I launch the app and choose "Bacon" + "Tomato", I can see pending backups using dumpsys backup. So I force run it (bgmr run => pendings disappear) and uninstall the app.
When I restore it, logcat tells me "No restore data available" and of course, the settings aren't displayed with the correct info.
Any ideas what I could be doing wrong ?
When you uninstall the app the backup data got removed. Lookup logs for
BackupManagerService: Removing backed-up knowledge of <app package>
Seems that backup/restore process can vary from manufacturer and device. Testing Backup and Restore document can simple work by uninstalling and installing using a nexus device, but I would not expect the same behavior and consistency on every device.
See also this answer https://stackoverflow.com/a/13648673/1598308
Had the same error, only years later. It's probably because you are using Google Transport instead of LocalTransport. Google imposes a rate limit of 24 hours for every backup, so it's trying to create a backup, but it doesn't, and the restore fails.
Run adb shell bmgr list transports to see the transports.
Run adb shell bmgr transport android/com.android.internal.backup.LocalTransport to change the transport to Local.