Skip to content

Documenting some native interop things.#13115

Open
jwill wants to merge 8 commits intomainfrom
native-interop-things
Open

Documenting some native interop things.#13115
jwill wants to merge 8 commits intomainfrom
native-interop-things

Conversation

@jwill
Copy link
Contributor

@jwill jwill commented Feb 25, 2026

Description of what this PR is changing or adding, and why:

This is PR is reimagining some of the Platform Integration section for demonstration purposes. Consider it a draft to advance the conversation.

Issues fixed by this PR (if any):

PRs or commits this PR depends on (if any):

Presubmit checklist

  • If you are unwilling, or unable, to sign the CLA, even for a tiny, one-word PR, please file an issue instead of a PR.
  • If this PR is not meant to land until a future stable release, mark it as draft with an explanation.
  • This PR follows the Google Developer Documentation Style Guidelines—for example, it doesn't use i.e. or e.g., and it avoids I and we (first-person pronouns).
  • This PR uses semantic line breaks
    of 80 characters or fewer.

@jwill jwill requested review from a team and sfshaza2 as code owners February 25, 2026 04:08
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @jwill, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly expands and refines the documentation for Android platform integration within Flutter. It introduces jnigen as a key tool for direct native interop, providing detailed guides for common use cases like launching activities and managing permissions. The changes aim to offer clearer, more up-to-date pathways for developers to interact with native Android functionalities, alongside a new overview of available interop options and improved navigation.

Highlights

  • New Native Interop Documentation: Introduced new documentation pages detailing how to use jnigen for calling native Android APIs and requesting permissions from Flutter, providing a modern approach to platform integration.
  • Updated Android Activity Launch Guide: Revised the guide for launching Android activities to include jnigen as an alternative to traditional Method Channels, offering comprehensive steps for both methods.
  • Overview of Platform-Specific Code Options: Added a new page that outlines various strategies for integrating platform-specific code, including FFI/JNI, self-managed platform channels, and Pigeon, along with guidance on when to use each.
  • Navigation Restructuring: Updated the site's navigation (default.yml) to incorporate the new documentation and clarify existing entries related to platform integration.
  • New JNI Call Lifecycle Diagrams: Added SVG diagrams illustrating the Java Native Interface (JNI) call lifecycle for both dark and light themes to enhance visual understanding of the process.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • site/web/assets/images/android/jni-call-lifecycle-dark.svg
    • Added a new SVG diagram illustrating the JNI call lifecycle for dark themes.
  • site/web/assets/images/android/jni-call-lifecycle-light.svg
    • Added a new SVG diagram illustrating the JNI call lifecycle for light themes.
  • src/content/platform-integration/android/call-jetpack-apis.md
    • Renamed to src/content/platform-integration/android/call-native-apis.md.
    • Updated title and description to reflect a broader scope of calling native APIs.
  • src/content/platform-integration/android/compose-activity.md
    • Updated content to introduce jnigen as an alternative to Method Channels for launching activities.
    • Provided detailed steps for configuring jnigen and modifying Android build files and manifest.
    • Added code examples for jnigen setup and Dart-side calls.
  • src/content/platform-integration/android/jnigen.md
    • Added a new documentation page explaining jnigen for calling native Android APIs.
    • Included sections on jnigen setup, configuration, and calling Dart bindings with examples like displaying a Toast message.
  • src/content/platform-integration/android/request-permission.md
    • Added a new documentation page detailing how to request Android permissions using jnigen within a Flutter plugin.
    • Provided jnigen setup and plugin implementation details, along with usage examples.
  • src/content/platform-integration/native-code-options.md
    • Added a new documentation page outlining different options for calling platform-specific code (FFI/JNI, self-managed platform channels, Pigeon).
    • Included guidance on when to choose each interop method based on specific use cases.
  • src/content/platform-integration/platform-channels.md
    • Updated the title and short title to better reflect its focus on message passing for platform-specific code.
  • src/data/sidenav/default.yml
    • Modified the navigation structure to include new documentation pages.
    • Updated titles for existing platform integration topics to improve clarity and organization.
Activity
  • jwill created this pull request with the intent to reimagine and advance the conversation around the Platform Integration section documentation.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This PR significantly refactors the documentation around native platform integration, introducing jnigen as a primary way to interact with native Android code. It adds several new pages explaining jnigen and providing examples for launching activities and requesting permissions. The existing documentation is updated to reflect this new structure. Overall, this is a great improvement to the documentation. I've found a few issues, mostly in the code snippets within the markdown files, such as duplicated dependencies and incorrect language tags for code blocks. There are also some minor typos and inconsistencies that should be addressed to improve clarity.


The APISummarizer is a tool that reads source and bytecode to determine which classes and functions are present. The abstract syntax tree defining the desired classes is read to create Dart versions with modifications to account for the differences between the Java platform and Dart.

Diagram should go here
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

This placeholder text should be removed since the diagram has been added below.

'androidx.activity.result.ActivityResultLauncher',
'androidx.activity.result.contract.ActivityResultContract',
'android.content.Intent',
//'android.content.Context',
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

This class is commented out in the list of classes for jnigen. If it's not needed for the example, it would be clearer to remove it to avoid confusion.

jwill and others added 2 commits February 24, 2026 20:12
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@flutter-website-bot
Copy link
Collaborator

flutter-website-bot commented Feb 25, 2026

Visit the preview URL for this PR (updated for commit d219e50):

https://flutter-docs-prod--pr13115-native-interop-things-pya9nu29.web.app

jwill and others added 4 commits February 24, 2026 20:14
Removed placeholder for diagram and extra line breaks.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@sfshaza2 sfshaza2 requested a review from lamek February 25, 2026 05:36
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.

3 participants