Interface Android application with Termux on the same device - Android Q&A, Help & Troubleshooting

Greetings. This is my first post; if another forum would have been more appropriate, please let me know.
My team has developed some machine learning software on Linux, mostly in Python, and mostly in the area of image and speech processing. Much of our input comes from Android devices, which exchange data with the backend server. Due to latency and other issues, we would like to look at putting our machine learning software on the Android device itself. Termux looks like an interesting solution; perhaps you know of other Linux shell apps.
My main question is: For communications between the "real" Android app, typically a Java program developed with Android Studio, and the "Linux machine" on the device, is the Linux instance treated like another system, with its own IP? Or is there a way to communicate directly between, say a camera app on the phone and the Linux instance?
btw, I am aware that Android OS is a Linux variant, so perhaps Termux is running on the same kernel?
Thanks,
Sid

Related

[Q] Wine-like iOS emulation?

Hello All,
My question is whether the reverse-engineering of iOS's API is being looked at as an option any time soon. I would be interested in something similar to Wine (Wine Is Not an Emulator), which is a reverse engineering of the Win32API and allows you to run Windows .exe files natively in Linux or Mac OS. I am aware of iEmu (and it's unfortunate suspension).
However, my interest is not in getting iOS itself running on my phone, but instead I would like to run the apps themselves. I'm pretty sure there isn't currently a project on this. If there is, can you inform me of it?
If there is not, I would like to discuss the difficulty of implementing this. I could definitely be an aid in starting a project of ths nature.
Here are some things about iOS's apps I am unfamiliar with (I am aware that this specific section of the post may be more fit for the iOS forum):
Does the Obj-C code compiled for iOS resemble native ARM code (the iPhone chips are ARM to the best of my knowledge), like how C++ would be compiled, or does it resemble something more like C# or Java, compiled into bytecode that is executed by a library?
Compared to the size of the .NET framework or Win32API, how big is the iOS library?
Has a successful program been created that can run Obj-C code?
Would this have to be worked from the ground up (figuring out how Obj-C compiles in the first place), or has there been some effort already mounted similar to this?
I am aware of the extreme difficulty in implementing this. However, I'm sure this was thought while planning Wine or Mono. I'm not even suggesting this be made, but I'm simply asking on your opinion on the general difficulty (can it be done).
Thank you,
- κυριακος
kupiakos42 said:
Hello All,
My question is whether the reverse-engineering of iOS's API is being looked at as an option any time soon. I would be interested in something similar to Wine (Wine Is Not an Emulator), which is a reverse engineering of the Win32API and allows you to run Windows .exe files natively in Linux or Mac OS. I am aware of iEmu (and it's unfortunate suspension).
However, my interest is not in getting iOS itself running on my phone, but instead I would like to run the apps themselves. I'm pretty sure there isn't currently a project on this. If there is, can you inform me of it?
If there is not, I would like to discuss the difficulty of implementing this. I could definitely be an aid in starting a project of ths nature.
Here are some things about iOS's apps I am unfamiliar with (I am aware that this specific section of the post may be more fit for the iOS forum):
Does the Obj-C code compiled for iOS resemble native ARM code (the iPhone chips are ARM to the best of my knowledge), like how C++ would be compiled, or does it resemble something more like C# or Java, compiled into bytecode that is executed by a library?
Compared to the size of the .NET framework or Win32API, how big is the iOS library?
Has a successful program been created that can run Obj-C code?
Would this have to be worked from the ground up (figuring out how Obj-C compiles in the first place), or has there been some effort already mounted similar to this?
I am aware of the extreme difficulty in implementing this. However, I'm sure this was thought while planning Wine or Mono. I'm not even suggesting this be made, but I'm simply asking on your opinion on the general difficulty (can it be done).
Thank you,
- κυριακος
Click to expand...
Click to collapse
Hey and welcome to the forum's I would like to know this as well but I do not know any project and any that gets started and gains popularity gets chased down by Apple's legal team quite quickly. I have my doubts that this could happen (I would be glad if someone could prove me wrong) because iOS and its apps work on 12 devices and Android has hundreds of devices, most with different hardware. Windows apps are built for variable hardware, likewise with Linux and now Mac OS X. Sorry but as much of a pessimist as I seem I do not think it's possible but I'd love to be proven wrong. (Can someone at least make a frigging Windows Mobile runtime)

[Q] Android technical introduction

Hi. I'm about to get my first Android phone, and would naturally like to know more about the OS. I would describe myself as intimately familiar with ordinary GNU/Linux systems, but let's face it, Android is hardly your ordinary such creature. Moreover, there seems to be very few technical introductions to Android around; those I've found tend to be idiotic user's guides (not technical at all) or focused on software development (interesting, but not what I'm looking for right now).
Things I wonder about with Android include:
There's an unusual libc, right? Is the GNU userland around, though?
The file system directory structure. It's hardly LSB-compliant, eh?
The package system. Everything I've come across is centered around the SDK, and hides many of the details of what goes on here. Sub-questions: Is it only "apps" (gah, I hate the word, I'm sorry) that use the package manager, or is everything covered by it, as in a normal Linux system?
The boot loader. Experience with other ARM/non-x86-systems indicate this is a world very different from GRUB, and also a highly varied one.
How do shared libraries fit into the Android ecosystem? Some places I get the impression everything is static. Is that really true?
What's this non-X display system? How do you configure it, etc.?
What's the init system like?
As far as I've understood, the actual phone software (is "baseband" the right terminology?) tends to be proprietary and separate from the OS. How does it fit into all of this? Does the OS execute code at some mysterious memory location? Is some special-purpose hardware run? Is it just a standard process? Is it in kernel-space?
I'm not looking to get these questions answered here. Rather, I'm asking: Are there any documents or books around that try to fill the role of bringing an experienced Linux user with decent development background and technical knowledge into Android?

What apps can Ubuntu Touch run?

I did some research and this is what I believe it would be:
apps written for UT (developed with QML)
any linux binaries, given that they are compiled for ARM and that corresponding non-kernel libraries or services that are being used are present in UT
QEMU will help out for x86 versions
android apps: can be run if someone writes an emulator for UT (probably not developed by Canonical)
otherwise there will probably be a way to easily port android apps to UT
windows software: the ARM versions (WinRT) should be able to be run with the ARM version of Wine
for x86 versions QEMU can emulate the x86 environment for the x86 version of Wine to run the software
windows phone: not sure
OSX: through a virtual machine running OSX on top of QEMU
iOS: seems unlikely at the moment
Theoretically UT will be able to run A LOT of software... however, for the non-android and non-UT software it will depend on QEMU, Wine and the hardware of the phone. I'm confident about the hardware part (phones are getting more powerful by the day) and therefore believe that we'll be getting a powerful desktop with a vast selection of software to run when having connected the UT phone to a dock with screen and input devices.
The question for what apps UT can run seem to pop up quite a lot so making this a sticky thread might be a good idea...
I'm not 100% sure about the statements I made above so please do give feedback and suggestions for additional info.
Win8 apps? What?
Fatal1ty_18_RUS said:
Win8 apps? What?
Click to expand...
Click to collapse
Well, I guess maybe it should read this:
win8 software compiled for ARM (which should be WinRT software...?) can be emulated with Wine
I'm not too sure about win8 phone apps... suggestions?
It's entirely possible to run x86 windows applications on ARM, see this thread
http://forum.xda-developers.com/showthread.php?t=1258506
And the official site
http://wiki.winehq.org/ARM
Note that WINE Is Not an Emulator. It just provides an environment that allows windows applications to run on Linux and X.
To get x86 applications to work on ARM you need an emulator, which what qemu is. And the above links are about using Wine and qemu together.
BukaKing said:
It's entirely possible to run x86 windows applications on ARM, see this thread
http://forum.xda-developers.com/showthread.php?t=1258506
And the official site
http://wiki.winehq.org/ARM
Note that WINE Is Not an Emulator. It just provides an environment that allows windows applications to run on Linux and X.
To get x86 applications to work on ARM you need an emulator, which what qemu is. And the above links are about using Wine and qemu together.
Click to expand...
Click to collapse
You're absolutely right... Wine isn't an emulator technically speaking. As I got to know it's also in the name! (WINE stands for: Wine Is Not an Emulator)
Haven't heard about qemu... good to know!
Thanks for the info, I'll update that!
Why develop "bluestacks" for cyanogenmod modification stripped from dalvikVM? Couldn't one just reimplement it in some way?
I uninstalled Ubuntu Touch from my N7 because there were no apps
You don't want to use Wine and all that stuff on a mobile environment, not even if it's docked.. It's not that easy as installing Wine for ARM, or supposedly on an Intel atom powered phone. You want applications that are breed for Ubuntu and Ubuntu only, honestly, you guys ran Windows apps on Wine before and you know it's a real pain (and this is on desktop, imagine on a smartphone)..
Don't get me wrong, it's totally possible but by the time you get all this working and configured you're better off learning QML and making the program from scratch.

[Q] Tablet ubuntu able to run edubuntu (kde etc)?

Hi all
Does anyone know if I can run kde-based software on the developer alpha of Ubuntu for tablets yet please? Not expecting reliability, just want to do some child user testing of the edubuntu suite on tablets.
Thanks
Chris
Currently you can't and probably neither in the near futur 'cause you need an X Server for that.
And there is no X server on ubuntu touch.
Huge thanks, that is really useful
Hempe said:
Currently you can't and probably neither in the near futur 'cause you need an X Server for that.
And there is no X server on ubuntu touch.
Click to expand...
Click to collapse
After some research on your reply I've a couple questions. Does it mean the Unity interface doesn't need X-server? Or are they just using a temporary workaround until X-server is implemented?
And does this apply to both Ubuntu for Android, and Ubuntu for tablets?
Huge thanks
Having done some further research I've made my decision - thanks hugely for providing the missing link in my knowledge. What follows is my best interpretation of the rumours.
Currently in place of X-server is SurfaceFlinger, ("because X-server uses 30 yr old code" - Canonical). Canonical publicly dabbled with using Wayland until mid-Feb, then decided to create their own revamped display server from scratch, called Mir, which they seem to have been working on since mid last year, and are trying to get GPU vendors to support, written to run across all devices and to meet the needs of the Unity interface, and written in Qt/QML which is what they want native apps written in.
Bottom line for me, is that the technology is still right up there in the clouds and nowhere near decided enough to base my business strategy on. Also, Ubuntu for tablets seems a pretty thin version of Ubuntu anyway, so Edubuntu was never an option and I'm unlikely to be able to leverage much from Ubuntu's Open Source libraries anyway.
Like others, (see the comment on jonobacon.org below), I find it frustrating that the wealth of code written for Ubuntu is no longer usable, but I reckon this is probably necessary to squeeze the most out of every single CPU cycle and milliamp. Ubuntu for tablet is dead in the water if it kills the battery and performs worse than the established competitors.
Therefore all indications are I need to write for Android, keeping my options as open as possible to migrate. So it is now Titanium/UnityIDE versus HTML5, particularly assessing relative performance.
http://www.omgubuntu.co.uk/2013/03/canonical-announce-custom-display-server-mir-not-wayland-not-x
http://www.jonobacon.org/2013/02/21/five-ubuntu-touch-facts/ -- not the article but the comment starting "In that case, wouldn't it be better to port existing apps instead of...."
http://www.omgubuntu.co.uk/2013/02/canonical-working-on-new-display-server
http://www.phoronix.com/scan.php?page=news_item&px=MTMwOTM
Just to clarify.
1. There are plans to make a X-Mir compatibility layer that will allow you to run programs that require an X-Server to work with mir.
2. Not all is lost at the moment it just looks that way.
Only Graphical Userinterfaces are affected. Your commandline tools and libraries don't need to be changed.
3. If you are looking for platform to write apps for, well there is worke being done to let you run your QML apps (intended for ubuntu touch) on android.
So if you choose to make QML apps they can be or will be able to run on linux, mac, windows and android
Wow, huge thanks, I missed that.
Does this mean EVERYTHING Ubuntu without a GUI will work? I want to run a NodeJS server. How likely is it that it will work perfectly now? How likely is it that it will work perfectly in the (nominally October 2013) release? (Sorry, just give me a keyword and I'll go off and do my research.)
Is Canonical planning to get X-Mir into the next ~Oct release?
My other query was whether QML on Android would perform as well. For others interested, it looks like it works directly with the Android SurfaceFlinger, bypassing the Dalvik VM, so performance should compare with native Java code.
Huge thanks once again
Chris
Sources:
http://www.youtube.com/watch?v=TEkubKZaUt8
http://victorpalau.net/2013/01/25/ubuntu-qml-todo-android-vs-ubuntu/

Android app framework suggestion.

Hello all!
Would it be possible to develop a framework of some sorts to install android apps natively instead of using Darwin or JVM on Ubuntu Touch?
The way I see it (might be a little too simple) is to convert the bytecode to native code and write wrapper functions for Android function calls or something like that. Is it possible?
Android doesn't use Darwin or the JVM (In the strictest sense), it uses either the Dalvik VM (which is based off Java, but is not Java, nor is it a JVM in the strictest sense [as in, executes applications made for the Java JVM]) or the Android Runtime (ART).
To my knowledge there is no Android analog to WINE (what you're proposing). There are applications such as Genymotion and Shashlik but those either aren't targeting ARM or aren't ready for ARM yet.
It's quite possible, if you ported the Android Runtime or Dalvik VM over to a WINE-esque application, but no, to my knowledge there are no projects doing this.
As Android is coming to Chromebooks it may be possible to just replicate the same container on Ubuntu Touch - it may require some work to make Mir work with whatever interface Chromebook's android port talks to (Freon?) but Google will do most of the effort here
grandrew said:
As Android is coming to Chromebooks it may be possible to just replicate the same container on Ubuntu Touch - it may require some work to make Mir work with whatever interface Chromebook's android port talks to (Freon?) but Google will do most of the effort here
Click to expand...
Click to collapse
Android itself is NOT coming to Chromebooks, this is simply Google's Android Runtime for Chrome being released into mainstream usage (see the Archon project for more information about this runtime.), This is still an emulated Android device (albeit more optimized so it runs faster, likely using x86 binaries) that runs under Chrome's NACL platform, it is NOT Android on Chromebooks as many news sources would like to suggest.
At the moment, Chromium does not run very well inside XMir (which is why I didn't give it any real thought there), but yes, this and the Android Runtime for Chrome should fill this gap perfectly. In the future though, it may be possible to use the LXC container with some work done to surface_flinger and the Android frameworks (to support Mir's windowing system ofc) to run the applications inside the Android container.
Like I said though, Google's Chromium runtime would work. But we currently have no hardware acceleration inside of legacy X11 applications, limited filesystem access inside said legacy container (only the XDG standard folders: Downloads, Documents, Music, Pictures are mounted into the legacy container), We also don't really have good, working OpenGL available to X11 applications since GPU access is done through libhybris which X11 knows nothing about.
It's possible to get around this similar to how Canonical has done it on the PC's development version of Unity8 and get Hardware Acceleration (truthfully, I haven't tested to see if it works with the android mirplatform packages though) by turning on DRI/DRM, I did this in my tweaked kernel, but it doesn't seem to provide any performance improvements with the freedreno X11 driver installed (I saw no indication that XMir initialized the freedreno driver at all, only Mesa's Software Rasterizing Interface driver.)

Categories

Resources