D2XX Sample for Android - android

Can anyone give me a step by step instruction on how to try the D2XX Sample on this one:
http://www.ftdichip.com/Support/Documents/TechnicalNotes/TN_134_FTDI_Android_D2XX_Driver.pdf
im having troubles trying it on my device. as per requirement. my device is already rooted and i have also ndk-build the files but its showing force close when i ran the project.

Following are the steps you need to take in order to run the sample demo.
install the sample application on your android device.
connect your device via adb.
access your device using adb shell.
type cd /dev/bus/usb
then type ls
you should see directories such as 001 and 002.
go to each directory e.g., cd 001 .
then use the following command to give your application access to usb:
chmod 666 *
start your application and it should now detect your ftdi device and you would be able to transmit and receive data.
Install the application on your android box.

Related

How to run cloned (dual) apps via adb shell

Could someone tell how to run cloned (dual) application via adb shell. The smartphone has MIUI 11 and the app is TelegramX, for example. Application clone emulator is by default.
I get the original application when I try to run the app via:
adb shell
monkey -p org.thunderdog.challegram 1
The package list tells only this point:
package:org.thunderdog.challegram
And no hint to the cloned one.
Meanwhile, directory to the clone application is:
/data/user/999/org.thunderdog.challegram
instead of
/data/data/org.thunderdog.challegram that original has. Prpbably, it can be helpfull somehow.
I can't find anywhere documentation about how Dual apps are implemented and how to run such apps through adb.
Thanks in advance!
adb shell
Once you’re in an ADB shell, enter the following command:
settings get secure clone_app_list
If you are already using the App Twin feature, then you should see either one or two package names returned with this command. If you aren’t using this feature, this string will be empty. Now, we will either append to the existing list or create a new list of apps to clone.
settings put secure clone_app_list "PACKAGE#1;PACKAGE#2;PACKAGE#3"
Source: [1]: https://www.xda-developers.com/how-to-clone-any-application-with-emuis-app-twin-feature-no-root/

Android Studio - Android Device Monitor's File explorer not working

I have just learnt using preferences in Android. For debugging purpose I need to access the preferences files. I googled and found the default location of the preference file and also how to access it via Android Device Monitor.
Somehow I am not able to open any folders under the File explorer tab of the Android device monitor. They just aren't responding. I tried waiting for ADM to load and tried again but no success. (Double click on folder is not working, STRANGE!)
Do we need to configure before using it? I am using Android studio.
Any help would be appreciated.
Attaching image
Finally I found how to make it work.
goto run -> location where your adb is
Ex: C:\Program Files (x86)\Android\android-sdk\platform-tools
type adb root , Enter (Your phone must have root)
If this doesn't work, install this app on your phone: [root] adbd Insecure or its free alternative here (update: link broken now).
Get more info at http://forum.xda-developers.com/showthread.php?t=1687590
You will need either to use the emulator or to have a rooted phone to use all functionalities.
Root your device and open adb shell and change the permissions as:
$ adb shell
$ su
1|root#android:/ # chmod -R 777 data/

How to use android device as host to pull logs from another android device?

Usually we use windows/linux machines to pull logcat info from an android device.
Is it possible to use android tablet/phone to act as host and get the logs from another android phone connected to it?
This is possible. The host Android device needs to be defined as a USB host. Then, once a connection is established, all of the same commands can be run, assuming that ADB is installed on the host device.
See here for more discussion on USB Host Mode support and compatible cables: https://android.stackexchange.com/questions/36887/how-can-i-determine-if-my-device-has-usb-host-mode-otg-support
It is useful to have a terminal program, such as Terminal IDE to issue commands from, and using busybox to provide additional commands would also be beneficial.
ADB comes as part of the AOSP source, so it a device is based off AOSP, then it will possibly include ADB. ADB source is located in /system/core/adb in the AOSP source tree.
Here is an example of a session where a Nitrogen6X (host) running a custom AOSP is used to connect to a Galaxy S3 cellphone (client). Note the use of Busybox and ADB, both of which are installed on the host. Busybox also happens to be installed on the client, but this is not necessary:
Thus in order to pull logs, just use regular ADB commands (e.g. to copy files), or run logcat, as indicated below:

how could I transfer file from terminal to screen /dev/tty.*(android machine)?

I'm developing android set-top box app.
So, I have android box and its adb is REALLY SLOW.
When I have to install .apk file to debug my project, I use adb connect [ip address] via wifi and then build & run with Android Studio because the set-top box doesn't have USB port.
But it has serial port so I can connect its shell by screen /dev/tty.usb-serialblablabla 115200. when I use that command, I can see exactly same screen as one of adb shell.
Its adb shell(via wifi) shows very very slow performance.
For example, if I want to run pm list packages, I should type 'pm list packages' and wait for 2min.and then type enter key.(...sigh)
Whereas,Using screen /dev/tty.* methods respond promptly.
I don't know where this difference is come from.
but it is not matter of wifi. I checked its speed. it is quite normal.
In this circumstance, I click Run button in Android Studio after adb connect.
gradle build takes about 10sec.
upload .apk(10.2mb) takes about 10min (sigh).
Because screen ... way is much faster then adb connect way, I want push my .apk into device via 'screen'. how can I do? OR is there anything I can do to reduce time for putting .apk in android device?
You really should find out why adb transfers take so long. But if you insist on using serial console for uploads instead - you could just use any terminal application with XMODEM support on PC side to send the file and busybox rx -b <filename.apk> command on android side to save it. Then pm install <filename.apk> to install it.

Run adb pull and push command from inside an application programmatically

I am developing an application in which I have to put as well as get some files from Computer(i.e Windows system) using USB.
I searched the web but didn't get anything helpful. I have an idea about command line so I am able to do this by using commands like
./adb -s emulator-5554 pull /sdcard/juned.jpg c:/user/juned/images/
It will copy juned.jpg file in specified directory of system, but is it possible to run same command programmatically ?
Till now I got one sample application in Android Samples named AdbTest which is available under /root/android-sdks/samples/android-18/legacy/USB/ directory, I have tried to compile that application but it shows nothing.
In that application under xml directory device_filter.xml file is there. In that file
<resources>
<usb-device class="255" subclass="66" protocol="1" />
</resources>
What value should I provide to make it working with my device ?
And is it possible to run adb commands from indide an application programmatically?
Edit
So far I came to know that, adb command can not be executed in non rooted devices, so is there any other way to transfer files using USB ?
Its not possible for Devices which are not rooted
Since to run your command it requires Su permission (Super User) .
Your command will be system/bin/ Su / -command
non rooted device don't have access to system/bin/ Su
you can root your emulator by Installing Superuser.apk
or try How to get root access on Android emulator?

Categories

Resources