Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Call arbitrary Android intents and get result back #1217

Merged
merged 9 commits into from
May 23, 2021

Conversation

t-arn
Copy link
Contributor

@t-arn t-arn commented Mar 9, 2021

This PR allows us to invoke arbitrary Android intents and get back their result.
For this, the async method invoke_intent_for_result in toga_android\app.py can be called.
An example app is included that uses this method to invoke an intent from the OI Filemanager to select a file.
When no appropriate Activity is found which can handle the intent, a (Python) Exception is raised which is catched in the example app.

PR Checklist:

  • All new features have been tested
  • All new features have been documented
  • I have read the CONTRIBUTING.md file
  • I will abide by the code of conduct

Copy link
Member

@freakboy3742 freakboy3742 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The mechanics of Intent handling look solid; I've got a couple of cosmetic changes that I'll make directly (mostly around the way intent invocation is spelled in the API).

I'm also going to remove the android_intent demo; while I appreciate you adding it (and I imagine it helped with development), the examples folder shouldn't have "platform specific" demos.

async def do_stuff(self, widget, **kwargs):
if self.Intent is None:
from rubicon.java import JavaClass
self.Intent = JavaClass("android/content/Intent")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this being defined here, rather than using the toga_android.libs version?

@freakboy3742 freakboy3742 merged commit 183493a into beeware:master May 23, 2021
@t-arn t-arn deleted the android_intent branch May 25, 2021 12:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants