Get My location using Kivy or CLI? - java

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.

Related

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).

Run python script inside java on android

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.

Editing java files made by cordova to access GPS sensor in Android

I am trying to build a mobile android app with jquery mobile and cordova. I have found that the native GPS sensor cannot be accesses directly by cordova application. Is it possible to edit the java files created by cordova ,so that the sensor can be accessed?
Cordova has inside a lot of native plugin that allow you to do a lot of things BUT is not only this. As you can see in DOC you can create your custom plugin to performe some native code (java) and return the result to JS.
For GPS you can search a plugin, I found this https://github.com/apache/cordova-plugin-geolocation, it should works.
In any case Cordova isn't magic, you must know java and android sdk to do all

How to get access to computer files for development through Android Emulator

My problem is that I'm using parse.com to upload files, and I can't simply create a java project to do so, because it requires an Android context:
Parse.initialize(this, "", "");
I was wondering if there was a work around to access my computer's files through an Android emulator. I know the ACTUAL app technically wouldn't have any idea of my files, but the emulator is still running on my computer. Or is the emulator completely independent to near-perfectly imitate the real thing, and basically this would be impossible?
If the answer is no, what can I do aside from getting a phone and putting the files onto the phone?
You can use the Parse.com REST API to upload from anywhere.
The Parse API for Android is just a wrapper for this REST API.
There are also some existing Pure Java wrappers for the REST API by third parties. See the Java section of the Parse API Library page. Almonds in particular looks to give you what you want.

Compiling Java hardware API to run in Android.

I am a bit of a noob to Android.
I have a project that utilizes a sensor glove to input data in the from of sensor values to a device. The objective of my project is to interface this sensor glove with an Android device so that the information from the glove is sent wireleslly to the Android device where my application would do the necessary processing.
The glove came with a set of tools and APIs to program in Java with. My question is basically, can i compile my code written in java to work on the Android platform? I reference a set of Jar files in my original code. Will i be able to utilize the same Jar files when running my code in Android, or would i be able to compile the same java code to run in Android.
really appreciate the help,
If the jar contains compiled class files, it won't work. Your source code has to be compiled to work with the dalvik virtual machine, not java.
However, if you have the uncompiled class files, it will (likely) work with Android. Most standard Java libraries are also available on Android.

Categories