What am I trying to do?
I would like to be able to remotely update my Kivy code.
What have I tried?
os.system
From inside my Kivy code, I called os.system('pm install -r /sdcard/my_app.apk'). It doesn't seem to work.
Kivy Launcher
Execution of my app from Kivy Launcher failed because my imports were not found ImportError: No module named sqlalchemy. Besides, my splash screen was not shown and there was no direct shortcut on the desktop to my app.
The question
Can I use any of the methods above or any other way to deploy new versions of my kivy code? Do I have to use Google Play?
Thanks
I made an updater for this purpose: https://github.com/kived/py4a-updater
It supports normal updates (which will show the installation dialog to the user) as well as root updates (which will just update without user input). Obviously, you need a rooted device to use root updates.
Basically, you put your APK on a web site, along with a text file which contains the version number. The updater will check the version in that text file, and if the installed version doesn't match, it will download and update. Check out the UpdaterTest app, included in the git repo, for a usage example.
Related
I am extremely new to Android development. My company supports our own Android build for our devices using the AOSP build tree with some of our needed system services and APK's being build within the AOSP tree.
However, we are planning on moving to a vendor supplied Android build and we want to remove a system service from the AOSP tree and move it into a separately build and installed APK, but still be accessible as a system service to other installed applications.
Being so new to Android development I don't really even know where to begin.
As a first step I find where the APK for the system service is generated/output in the AOSP tree. I installed this APK onto our device. The installation appears to have worked. However, when an application runs that needs to use that system service, Android displays a message about how the system service has stopped.
1. What steps do I need to take to make this work?
2. What other information is needed to diagnose the problem? I'm so new to this I don't know what information I should be providing.
However, we are planning on moving to a vendor supplied Android build and we want to remove a system service from the AOSP tree and move it into a separately build and installed APK, but still be accessible as a system service to other installed applications.
Assuming you have made changes in ServiceManager to add your own system service in AOSP. Yes, it is possible to move your system service to a separate apk. This will reduce your platform dependencies. However, sepolicy changes will be still required(in order to add your service dynamically in ServiceManager). Here is the complete reference to add system service from apk:
https://devarea.com/aosp-creating-a-system-service/#.XOOD9KRS9EY
The installation appears to have worked. However, when an application runs that needs to use that system service, Android displays a message about how the system service has stopped
Please elaborate, what changes you have made, and root cause behind system service crash.
What steps do I need to take to make this work?
Suggest to move you system service to a separate apk. Please refer above link which explains creating system service (from apk).
When I create an APK while developing a Nativescript application, Nativescript stores all the application code in the generated APK file, and that helps me a lot in case something bad happened to the code[The code was deleted, Didn't commit changes I was working on for a long time,...]. When something bad happens to the code, I usually generate an APK from my android device using any APK Extractor tool and decompile it with JADX to obtain my original code and save my day.
Nativescript doesn't generate NEW APKs when I make changes to layout or js files[even though changes are applied on the android device]. Nativescript generates new APKs only when I build the project. and that doesn't help a lot when I need to restore my code after a lot of changes on it.
We're working on a nativescript application. We've been making changes on the application for about two days without generating new APK nor committing changes to git. The files where suddenly removed from pc and we don't know why.
We extracted an APK from the latest working version on the test android device, decompiled it and retrieved the code but the changes of the last two days weren't there.
Is there a way to restore the code from a Nativescript application installed on android devices? By restoring the code I mean even restore all the changes on the code after building the application.
Where/How does nativescript store the instant changes on the code for my application on the android device?
You can view your code by accessing the application data from adb.
connect to your application from adb
adb shell run-as org.nativescript.myapplication
and you can find your files in this directory
/data/data/org.nativescript.myapplication/files/app
It's not wise to depend on your APK for retaining your source code, you should probably use a Version Control System like Git, may be services like Github / BitBucket / GitLab etc., to maintain your source code.
While using a Version Control System, you should commit your changes regularly. That's the whole purpose here, even if you are not sure about your changes you can still use your own branch and keep the changes committed and merge to main branch only when it's fully ready.
I guess you are not using the --bundle option while you run / build the app which is recommended to keep your application lightweight at same time provides a minimal obfuscation using Uglify. With next major release of NativeScript this --bundle option will be marked as default, so you will no longer be able to extract your exact source code at all.
Also think if someone wants to hack your app while you haven't followed any obfuscation, it's easy to clone your work Or break the functionality as they wish. Learn more about securing your source code here.
Still regarding where the live changes are being stored, I think it will be within application data directory on Android.
I want my app to be able to create an environment where it can freely install and delete apps from this environment. The main purpose for this is so my app can install and update apk files for supporting apps without having to inform the user every time this happens. Is creating this environment possible?
Okay, here's the situation:
I'm developing an application for a client (or trying to do so). It requires much (if not all) of the same functionality as the built-in SMS/MMS application. So, I thought - HEY! Android is open source right? I can take the application and modify to my needs, right?
So, I found the code on github for the MMS/SMS application (for some reason, based on the AndroidManifest file, it calls my project I built, "ConversationList"). But I get TONS of errors involving the import com.google.android.mms.* package and a couple other packages.
Everyone keeps saying "it's a private/internal package", and "download the entire AOSP". But, HOW do I do this on Windows, and WHY can't I just download the appropriate packages to use in the program?
ALL I want to do is build a project in Eclipse deploy it to my phone, and then modify the necessary code. If Android is open source, why so many secret/internal packages? This is frustrating.
Any advice?
So, I found the code on github for the MMS/SMS application (for some reason, based on the AndroidManifest file, it calls my project I built, "ConversationList"). But I get TONS of errors involving the import com.google.android.mms.* package and a couple other packages.
AOSP applications like this are designed to be built as part of a firmware image, not as standalone apps.
But, HOW do I do this on Windows
Most likely, you don't. Cygwin might work. More likely, you will need to use OS X or Linux, such as running Linux in VirtualBox. And the result of your build will not run on anything, except as part of a firmware build that you use to replace the firmware on a device.
WHY can't I just download the appropriate packages to use in the program?
Because that application is designed to be built as part of a firmware image, not as a standalone app.
ALL I want to do is build a project in Eclipse deploy it to my phone, and then modify the necessary code.
Then find a project that is designed to be built as a standalone app as your starting point. Or, work on modifying the project you are trying to use to work as a standalone app, by ripping out all the functionality that depends upon things that are not in the app itself.
If Android is open source, why so many secret/internal packages?
They are not "secret". They are part of the firmware.
For example -- since you appear to be familiar with Windows -- it is entirely possible that "apps" like Control Panel are not designed to be built independently from the Windows OS. If you were able to download the source code to Windows and tried to load Control Panel into Visual Studio, it is eminently possible that you could not create some standalone CPANEL.EXE file just via that one project. Rather, you would need to use a customized Windows OS build process to build the whole OS, which would then contain a CPANEL.EXE that would run within that built version of the OS.
Most of the AOSP apps work this way. Some have been forked to create standalone apps -- K-9 Mail came from the early version of the AOSP email app. I have no idea if anyone has done this with the stock AOSP Messaging app or not.
You could instead fork TextSecure[0] as it is no system application but looks very similar to the stock messaging application. The AOSP application needs to be installed on /system/app which requires root and might not be what your customer wants.
Please note that this application is copylefted (GPLv3) so you'd have to give your client access to the source code under the terms of the GPL if you fork.
[0] https://github.com/WhisperSystems/TextSecure
I would like to create an App with python, but i need that it includes all it needs in order to operate correctly. I have saw this post about the ability to sell the app via and Market, but it didn't have a final answer there.
Currently the best solution i could find, is at this pdf chapter (from Pro SL4A Apress book), but still it seems that even if i create an .apk file, the user whom install that app would have to have the SL4A on his Android device.
Is there a way to incorporate the SL4A in the .apk file, or better yet, to incorporate just the needed stuff ?
As far as I'm aware, APKs created this way don't include the script interpreters that SL4A provides. According to the PDF you posted, it should request for SL4A and the relevant script interpreter to be installed when the APK is installed, however.
This question is now quite old, but for any other users who might come by here, it is now possible to embed the Python interpreter in an APK package. Look at this project for instructions and methods of doing so.
so what actually happens when compiling an APK via the method described in the book is a little bit different than what you have described. What actually happens is that upon installation of the APK file it will check to see if the user has Python installed, not SL4A. If the user does not have Python installed it will prompt for a download, similar to how certain applications prompt to install BusyBox in order to use certain commands. This means that the user doesn't need to have a scripting environment, or in fact even know what python is.
As for compiling 3rd party modules/libs into your APK, what happens is when you are compiling in Eclipse it will point to the folder on the computer containing python, and compile from there. That means that all you need to do in order to get extra modules or libraries into the APK are to make sure that they are included in the folder that Eclipse looks to when compiling the APK. By default I think that is your native Python folder, but I'm not 100% sure so somebody please correct me if I am wrong.
Hope this helps!