How to get android device directory from Python? in Windows - android

I'm making a script to sync some files from my pc to my android.
How can I list all androids directories connected (via usb) to my computer?
I tried to use this http://gallery.technet.microsoft.com/scriptcenter/488836b0-84e9-4c0c-b2cf-dd19f6e70f74 but I'm having too much trouble with all this windows dependencies. Tried to use the windll.kernel32 from ctypes too, but found it just too confusing to use (the lack of examples doesn't help).
There's any way to do this without installing an Android SDK?

If you mean detecting which removable media is Android storage, you could scan all removable drives for the Android/ or .android_secure/ folders, which would suggest the device is Android. Documentation here may be useful.

Related

Transfering Android Studio files to another PC

I'm currently using android studio to develop an app, but my pc seems pretty bad for it so I'm very afraid that it stops working and i can't access my codes anymore. Is there any way I can transfer the files to another computer? I have the app folder with all the codes, even tried using whatsapp, email and google drive to send the documents but it won't let me. If I buy another computer can I use an external hard drive to transfer my apps to the new computer? Idk if it matters, but i'll be switching from a MacOS to a Windows.
Sure. Just copy the folder where your project is in to an external hard drive, copy it in the other PC, install the same version of Android version you are using in the other PC and open that copied folder as a project with Android Studio.
There should be no problem.
Maybe you have also to reconfigure things like Firebase access or the like, but with repeating the process you did it should be enough.

Is it possible to run containers on android devices?

I’m a mobile developer and recently adept at using containers with docker. I’m developing a container architecture for my graduate project. One of the modules of this architecture would need to be run on an android device. But I could not find information on how to run a container on an android device. It could be something simple like an alpine image with python.
Can anyone tell me if there is a possibility to run a container on an android device with docker, or even kubernetes?
In 2021, the answer is definitely yes.
Here is a tutorial on that topic, which shows you how to run docker directly on Android, without VMs nor chroot. Note that you do need to root your phone and build a custom kernel though.
If you only want a quick look of docker running on android without getting your hands dirty, check out this comment on GitHub.
It is possible to use it for running docker on an android device using an application like termux or userland to install a qemu package.
The best way is to use alpine linux terminal, an android app available on github.
This alpine term app has a QEMU to run like alpine ISO. All things are automated
and this works with x86_64 kernel on any android.
Some android phones have a KVM kernel so this device can run faster alpine term
Also my friends made a video on a YouTube channel to run docker on any android phone without root.
I must note that I am not an expert in Android development. But I researched on this topic, and #Emile's answer is the easiest and closest you can get - as it seems.
You can actually run Fedora (and not only) image on top of the Termux and then launch Python inside. This is obviously not a docker, but might be helpful.You can find more info here.
In addition, I've found this topic on Quora which is a similar question:
Think about it: Docker abstracts the OS and that is all. The Android
OS is quite a different kernel than linux distributions, even though
it is linux. It might be tricky to get applications meant for a linux
distribution to run on Android/Docker.
One of the main reasons to use docker is that it can provide
self-contained packages of applications which do not affect the rest
of the system. The Android applications, packaged as .apk files are
just that.
Other than that I was able to find this topic on StackOverflow which does not really resolve the issue. As the issue might be related to AUFS and some Kernel features needed by LXT which are not present in Android - now some of them is from what I remember.
Also there is a claim that it is possible on docker forum and weibo (use translation to English), but there is only a screenshot provided by user and no details on how to do it, besides "it took a lot of effort" statement. So it would seam that this is still a not well known part, or maybe someone will be able to actually provide more complementary information - maybe try on Docker forum or GitHub.
We open the Android container, which can run the docker container on the Android operating system. Not only can run Docker containers, but also other containers, such as podman. In addition, we have also enabled the container to support checkpoint and restore functions, and support the migration of containers across architectures and operating systems. See https://github.com/CGCL-codes/Android-Container for details.
Some people think it's impossible but it isn't you can run a full ubuntu on your phone by this android app https://play.google.com/store/apps/details?id=com.termux
You can even install gui envrioment and connect over vnc everything is supported in this so also docker or website hosting and so on
(Make sure you follow al install steps in the app https://play.google.com/store/apps/details?id=studio.com.techriz.andronix to install linuxes like arch or ubuntu fedora or more you have to install these it doesn't work by just opening termux)
YOU DON'T HAVE TO ROOT TO USE THIS METHOD

Android NDK| native library for USB storage management.

I am trying to build an app which involves formatting usb drives, changing the partition scheme and creating partitions.
After a lot of research I found that Android SDK does not provide tools or ways to access the information needed to do such tasks even with root.
So is there any C/C++ library which I could use? Or is there a better way?

Edit Android project remotely (FTP) using Android Studio

I have an android project checked out from git into an ubuntu server. I will be doing git check-in and check-out files inside this ubunut machine.
I have installed Android studio in my local system .i.e. windows machine.
Is it possible to use FTP in Android Studio to directly import the project from ubuntu server and edit them without copying to my local windows system. I did search around the internet and couldn't find any posts regarding how to do this.
I'm aware that we can install Android studio in Ubuntu itself, but I'm not allowed to do that.
It would be very helpful if anyone throws some light on this.
FTP is not enough, you need something like NFS that allows a user on a client computer to access files over a computer network much like local storage is accessed.
It looks like this functionality is only available on IntelliJ IDEA Ultimate Edition, which Android Studio is based on. It looks like the server only stores the files and IDEA on the client does the heavy lifting. For Android, there's also the question of running emulators, which I assume is also done on the client.
Not sure what the delta is between AS and IDEA, but you can develop Android apps on it.

accessing android os root files

i have the following doubt:
i have read that android os is based on linux, and i imagine it may have the same structure that ubuntu (in terms of file configurations: /root, /dev, etc).
so, is it possible to run an application written in C in android? just as it is possible to do in ubuntu? if so, how can i do that?
also, how can i get access to the root files through an android application (written in java)? and how to get access to the behavior of the os (in terms of interruptions for example)?
thanks in advance for your answers.
gus
Basic answer: Running a C app on Android isn't supported, except through the Native Development Kit (NDK).
You can't get access to the root files except by rooting a phone.
You can get access to some OS behavior through the API. Basically, if it's not part of the API, you can't access it.
The Android OS is based on Linux, but it's an OS, not a windowing server like X or a desktop environment like Gnome or KDE.
You may run C and C++ code on android using NDK. You may use also QT framework. But code is runing in virtual machine named Davlik. Android have root acount , but it is default not available for user. Therefore, access to directory is dependend for chmod.
If you would like read about access to low level in android:
http://www.phrack.org/issues.html?issue=68&id=6
And about architecture this system:
https://developer.android.com/guide/basics/what-is-android.html
You can run programs using Runtime.exec. As an example, you can see Terminal IDE which runs many different programs including ssh, vim and bash. It's also open source so you can learn from the code. You will probably have to include the executable as a resource or asset and then copy to a local directory, grant execute permissions, then run with Runtime.exec. You still have limited user permissions as your app runs under a restricted account unless the device is rooted and you request root access.
an android smartphone/tablet works with an Arm cpu, not a x85. the architecture is different.
but you CAN run a C application in android if you cross compile it for arm linux. or you can use a c compiler inside android device. people ported c compiler to android. you can try C4DROID and in android market. but you can only run compiled program in system memory because of android permissions about sd card.

Categories

Resources