beeware / briefcase-android-gradle-template

A template for generating Android Gradle projects with Briefcase
MIT License
18 stars 19 forks source link

how in beware One can access the phone contacts of all their names and phone numbers and call them at the press of a button #65

Closed AmirMohammadDehghan closed 1 year ago

AmirMohammadDehghan commented 1 year ago

What is the problem or limitation you are having?

want to access the contacts, their names and phone numbers in my programs and use them in my program, and also how can I make a phone call with a number by pressing a button. I could not find this feature in beeware. Please guide me if possible, if not, how to use the java code to do this in beeware and connect to my program and exchange data with python. I will be grateful if you answer

Describe the solution you'd like

I couldn't find way

Describe alternatives you've considered

how to use the java code to do this in beeware and connect to my program and exchange data with python. I will be grateful if you answer

Additional context

No response

freakboy3742 commented 1 year ago

You can access any native system API using the Chaquopy bridging layer. Wrap any class you need with a jclass object (or get one implicitly via import), then invoke the native system APIs from Python as if they were Python methods. There's no special handling required in this gradle template.

billyjuliux commented 1 year ago

Hi @freakboy3742 and @AmirMohammadDehghan, I've been searching for a while, yet I struggle to find the access to use the Chaquopy bridging layer in the Beeware Project. In the link that is mentioned, I couldn't find any clue as to how to include/import it in my project, and thus couldn't continue my project as I need access to android native camera.

I'd appreciate it if you or any can enlighten me on this. Thanks!

mhsmith commented 1 year ago

To access the camera you'll probably need to run an Intent, as described at https://github.com/beeware/toga/issues/1798. You can access Intent and any other necessary Java classes using the import statement, as shown here.

For more details of what the Intent should contain, and how to interpret its result, please search in some general Android programming resources. Android has produced several camera APIs, and I don't know what the current recommendations are.