I'm new here. Recently I'm developing android app based on Python Kivy. my app is about downloading post from Instagram and save it in android local storage. Its work fine in my android (Oppo A3s with android 8.1) but when I tested it to my friend's phone, which is newer version of android than me (android 10) its failed. When I run adb, it said permission denied. I was wondering and find solution on Internet and they said android 10 and newer not allowing to write directly to the storage (example: /sdcard/DCIM/Camera)
my question is: How to solve this and how to write file to /sdcard/DCIM/Camera in android 10? or how to save file in public storage that other app can use that files too?
Thanks lot for help :)
Related
I am making an Android app with Python (kivy), and I am using plyer's stt, which only supports Android. I used Pydroid3 to check my code, and it works, but I don't want to send the code from my pc to my phone every time I want to check if it works. Is there any way to run a .py file that only works on Android, on a Windows device? Like a virtual phone or something?
I found out that Android Studio has a built in Android Device Emulator, wich is basically a virtual Android device. Inside that you can download Pydroid 3 and run your Python code there. If your application requires addiditional permissions, you can use Pydroid Additional Permissions Plugin.
I have successfully compiled a few android packages with buildozer (e.g 'openweather' works just fine with an API key).
My Kivy file works fine.
When I include geopy, buildozer successfully compiles the kivy file, but the app crashes when I ask for the Lat/Lon position.
I have an API key from Nominatim/MapQuest:
in the 'main.py file': user_agent='API_key' or 'app_name' or my email address
in the buildozer'spec file':
requirements: pytyhon3, kivy, geopy
android.permissions= INTERNET
My question, what am I doing wrong?
Regards
Sybe
The permissions should be android.permissions = INTERNET, ACCESS_COARSE_LOCATION, ACCESS_FINE_LOCATION, if you need access to the devices gps.
Try to rebuilding your app with those permissions included and post the logcat output if it still crashes
I am currently learning Python as part of my job and was interested in the possibility of creating android applications using what I am learning. Unfortunately I only have access to a computed at work and the system is pretty locked down in that I cannot export work I create etc and the only device I have during my leisure time is my android phone.
I have heard about the possibility of using Kivy but have only seen reference to this being used on MacOS, Linux or Windows making me think my only choice would be running a virtual machine which would be less convenient than running a native tool. I have also seen that AIDE is a great tool for android app development on mobile but can only be used with C++/Java which would involve learning additional languages and PyDroid3 being a great python tool but don't know how this could be used to create android apps.
Any experience or knowledge in this area would be much appreciated. I understand the best scenario would be to either buy a laptop/pc and use PyCharm and/or Kivy or to learn Java and used the official Android development suite but in my current situation this is not possible.
Just download pydroid3 from play store and follow the steps to create an android app.
Install kivymd module using pip in pydroid3.
Watch kivymd tutorials on youtube to learn kivymd module , you can also refer to kivymd documentation on google.
Develop application using kivymd module in pydroid3.
Convert your python file to apk using kivy buildozer in google colab in chrome on your mobile phone.
I haven't used kivymd but I have used kivy in pyroid3 and it works really well on a phone. Also when you run the code it gives a really good indication of how the final app will look on the phone. But that said I have only used Buildozer to compile the .APK and this only works in Linux so for me that ment virtual Linux system.
I was watching some videos of Flutter, and it was impressive that Flutter has a Phone and you can see the phone with the app like this:
Also in kivy we make apps but when we run it we have the default interface like this one:
The thing is that I would like to change the image of the default display interface, or the figure of the ui to an iphone, is there a way to do it?
Flutter doesn't have a phone as you say. That is an iPhone simulator or an Android emulator. You can get an emulator by installing android studio (Android SDK to be precise ) and a simulator by installing Xcode. After the installation, you can then compile your kivy app into a package and run it on the android emulator or simulator.
Follow this documentation to see how to compile for Android.
I know we can launch an app in Android using Kivy launcher for android https://play.google.com/store/apps/details?id=org.kivy.pygame
and i can launch apps by the same as well . But i need to know how and where can we see the logs generated by the app in it ? For example if i run kivy app on my desktop i will be able to see logs on console but where will i find them when launching an app by kivy launcher ?
If we cant see logs is there any ways to make this possible ?
On android, kivy prints all python's normal terminal output to the android logcat stream. You can view this from the desktop by connecting your phone via usb and doing adb logcat. adb is provided by the android sdk, so if it's not in your path you can probably find it there. If you use buildozer, I think you can access its auto-downloaded android sdk using
buildozer android logcat
You can also view the adb output using some apps on the play store (may only work with older android versions though, I think something changed here).
Kivy may also store logs as text files somewhere on the sd card, possibly in the app directory (i.e. somewhere in the kivy launcher's kivy directory), but I haven't ever really used this, adb is a lot more convenient.
When your application is executed a .kivy folder will be created (if not already there).
In it you'll see a logs folder. The logs there are the same obtained via "adb logcat".