Skip to content

chore(android): add intent to broadcast font name#15193

Merged
mcdurdin merged 3 commits intokeymanapp:masterfrom
Nnyny:chore/android/sendCurrentFontName
Dec 1, 2025
Merged

chore(android): add intent to broadcast font name#15193
mcdurdin merged 3 commits intokeymanapp:masterfrom
Nnyny:chore/android/sendCurrentFontName

Conversation

@Nnyny
Copy link
Copy Markdown
Contributor

@Nnyny Nnyny commented Nov 20, 2025

This makes it possible for the Keyman Browser app to read the currently selected font name from the active Keyman keyboard

Test-bot: skip

@github-project-automation github-project-automation bot moved this to Todo in Keyman Nov 20, 2025
@keymanapp-test-bot keymanapp-test-bot bot added the user-test-missing User tests have not yet been defined for the PR label Nov 20, 2025
@keymanapp-test-bot
Copy link
Copy Markdown

keymanapp-test-bot bot commented Nov 20, 2025

User Test Results

Test specification and instructions

User tests are not required

@Nnyny Nnyny requested a review from mcdurdin November 20, 2025 05:46
@keymanapp-test-bot keymanapp-test-bot bot added this to the A19S16 milestone Nov 20, 2025
@keyman-server
Copy link
Copy Markdown
Collaborator

This pull request is from an external repo and will not automatically be built. The build must still be passed before it can be merged. Ask one of the team members to make a manual build of this PR.

@keymanapp-test-bot keymanapp-test-bot bot removed the user-test-missing User tests have not yet been defined for the PR label Nov 20, 2025
@mcdurdin mcdurdin changed the title chore: add intent to broadcast font name chore(android): add intent to broadcast font name Nov 20, 2025
@mcdurdin mcdurdin requested a review from darcywong00 November 20, 2025 06:46
if (keyboardInfo != null) {
String fontName = keyboardInfo.getFont();

Intent intent = new Intent("com.keyman.android.keyboard_changed");
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do we need to document this Intent in the API documentation, @darcywong00?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

So far, all our API documentation has been KMManager in Keyman Engine for Android.

afaict, we haven't had any Keyman app APIs

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

In that past, we've used KMManager.KeyboardEventHandler to signal events (not with intents though)

https://help.keyman.com/developer/engine/android/current-version/KeyboardEventHandler/

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

That signalling with KMManager.KeyboardEventHandler is inside the one app isn't it? This is looking at an external API surface.

afaict, we haven't had any Keyman app APIs

So we should establish a public API document then for the app for exactly this.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think it belongs more closely with Engine docs than end user docs. It's about integration, just at another level. Let's go with putting it into the Engine docs, under a new section. If we have to reorg Engine docs, that's also okay.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I bring a rock at #15247

if (keyboardInfo != null) {
String fontName = keyboardInfo.getFont();

Intent intent = new Intent("com.keyman.android.keyboard_changed");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

2 things. I think the Keyman application ID is still com.tavultesoft.kmapro and on Debug builds, it's com.tavultesoft.kmapro.debug.

Maybe you can try the following (distinguishing com.tavultesoft.kmea.BuildConfig from com.tavultesoft.kmapro.BuildConfig)

Suggested change
Intent intent = new Intent("com.keyman.android.keyboard_changed");
Intent intent = new Intent(com.tavultesoft.kmapro.BuildConfig.APPLICATION_ID . ".keyboard_changed");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should we only broadcast this when the font is not empty/null?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should we only broadcast this when the font is not empty/null?

Definitely should always broadcast. It is also helpful to know that a keyboard has changed. And if changing from a non-null font to a null font, we need to know that too.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think the Keyman application ID is still com.tavultesoft.kmapro and on Debug builds, it's com.tavultesoft.kmapro.debug.

Is it possible to change the application ID without impacting play store? I don't think so? If it is then com.keyman.android would be so much better!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is it possible to change the application ID without impacting play store? I don't think so?

From what I've read, we'd have to unpublish the current Keyman app (com.tavultesoft.kmapro) and then publish a "new" Keyman app (com.keyman.android). There's no user migration between the apps.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

From what I've read, we'd have to unpublish the current Keyman app (com.tavultesoft.kmapro) and then publish a "new" Keyman app (com.keyman.android). There's no user migration between the apps.

yeah so that's a no then 😁

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Separate question is whether we can use a different identifier for things like this moving forward?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@darcywong00 I couldn't access BuildConfig from Keyman browser. but I can make it works with "com.tavultesoft.kmapro.keyboard_changed".

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ahh. I see.

Do we assume if you're using a debug version of Keyman Browser, then you're also using a debug version of Keyman for Android?

Then we could do

Intent intent;
if  (BuildConfig.DEBUG) {
  intent = new Intent(com.tavultesoft.kmapro.debug.keyboard_changed");
} else {
  intent = new Intent(com.tavultesoft.kmapro.keyboard_changed");
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thank you. It works now and I have already committed it.

@keyman-server keyman-server modified the milestones: A19S16, A19S17 Nov 22, 2025
@mcdurdin mcdurdin merged commit 29be017 into keymanapp:master Dec 1, 2025
5 of 6 checks passed
@github-project-automation github-project-automation bot moved this from Todo to Done in Keyman Dec 1, 2025
@keyman-server
Copy link
Copy Markdown
Collaborator

Changes in this pull request will be available for download in Keyman version 19.0.168-alpha

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

4 participants