Run python script inside java on android - java

Is it possible to run "python" script inside "Java" in an android app?
The main app will be Java but some cryptography should be done in "python"
Is it possible to do this?

Running a python script inside android app is not practical at the moment, but what you can do is creating a HTTP web service for interpreting python and sending back the results to the android application.
Then it's just Android app communicating with a HTTP web service which is simpler than packing an interpreter.
This way it makes the app lighter too.

Related

Is it possible to run test code written by other languages in flutter?

I am trying to automate my webview app by using Appium, but code that I exported from Appium is written in java. Is it possible to test flutter app by test code written in other languages, not in dart?
UPDATE: You can use Appium in conjunction with Selenium. I think that should work. See: http://appium.io/docs/en/writing-running-appium/web/mobile-web/
If what the test framework does is to integrate with, or emulate, a browser, and manipulate the DOM in order to test, and
If your Dart application only manipulates the DOM to generate a web view -- e.g., it would work in a regular browser without using plugins,
Then yes, you can use such a tool (like Selenium) to test a Dart app.
The caveat here is, if you are using a WebView to embed your app in a mobile app framework, then these tools will have to have the ability to open an app on a mobile device to access the WebView.
If you can create an alternate scaffolding for your application, such that it can also run in a browser, not only as an embedded WebView in a mobile app, then the tools needed to test it are only simple web app testing frameworks.
This is generally a good approach if you can get faster feedback deploying to a web server and running your tests, than packaging the app and pushing it to a connected device.
It doesn't obviate the need to test in the WebView as there are often differences between browser capabilities as embedded in a WebView versus in a desktop browser, but any differences found would be purely based on the capabilities of the browser, as opposed to problems in your Dart logic.

Integrating matplotlib (Python) with Android Studio

I would like to know if it's possible to run some Python script containing matplotlib graphs (e.g 3D surfaces) on Android Studio.
If no, what could be another way I can do that?
Well, I don't know if you can run Python script inside the Android Studio, however you can create a Python API which listens on a specific endpoint and make a POST request to that API endpoint from code inside Android Studio. If you want to know how to create a service using Python, you can have a look at this link. You can also create an API using Flask/Django and deploy it as a service by making a systemd unit file (like it is mentioned here for CentOS).

Get My location using Kivy or CLI?

I am creating a app for android using Kivy (python) that will send my location to a email. But kivy is not able to do this as GPS is not directly supported. This is what I have thought as my next step, but I need help.
Is there any CLI command that can give me my location. I will run that command using os.system(commad), the basic method for running commands in python.
Is there any executable available, like a jar file, or a javascript file, that I can run from my code and that gives me my current position using GPS.
Any readymade code of Kivy or Java, that I can test on my Phone.
Kivy uses python-for-android to compile APKs for you. It also provides pyjnius to wrap Android/Java API calls. This lets you access things like the Location API. The Plyer project is a cross platform layer that uses pyjnius for the Android part. There is a GPS example in Plyer which you can compile and use on Android if you have Kivy and Buildozer set up properly. Or you can read the source code of the GPS for Android part of Plyer to make your calls via pyjnius.

The Bluestacks Android emulator is built using .Net?

I recently installed the Bluestacks Android emulator. I happened to look at the process running under ProcessExplorer and was surprised to see that it is a .NET application.
The HD-Frontend.exe is the Bluestacks UI process and is highlighted yellow because it has loaded the .NET framework. There are a number of other processes associated with Bluestacks and most are also .NET.
Opening the EXE in Reflector.NET also shows that it is .NET.
I thought Android was Java-based. What's going on here?
Android is Java-based, but that does not mean an Android emulator has to be written in Java -- just functionally emulate Android devices.
While BlueStack's site does not list any system requirements for its emulator that I could find, at least a couple sites -- e.g. Bazooka Apps and Android Emulator for PC -- mention .NET as a requirement.
Ultimately the proof of what's going on is right in the process list and Reflector results you found.
its an emulation tool whose job is to read the dex code respond to that how the android phone should respond and not to compile and run that dex so it could be on python or ruby also there is no boundation at all that you have to make android emulator on java becuase android is built upon java.

Run independent java program on android device

I have an android phone that runs on ics. I have a desktop application written in java which runs on desktop system.
Can I run independent java program on it?
Thanks
No, you can't run a java application written for desktop directly on Android. Android has a heavily modified java runtime environment.
But rewriting your application for Android shouldn't be too much of a pain, as you just have to convert your UI to Android widgets(called "View") and to adapt your code to Android [Activities](http://developer.android.com/guide/components/activities.html).

Categories