Skip to content

feat: Android: Support apps whose application id differs from class package name - #89

Open
philet wants to merge 1 commit into
capacitor-community:mainfrom
philet:android-differentiate-class-package-name-and-application-id
Open

feat: Android: Support apps whose application id differs from class package name#89
philet wants to merge 1 commit into
capacitor-community:mainfrom
philet:android-differentiate-class-package-name-and-application-id

Conversation

@philet

@philet philet commented Apr 24, 2026

Copy link
Copy Markdown

Usually the case if and app has test and production builds with different application ids.

…ackage name

Usually the case if and app has test and production builds with different application ids.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the Android implementation to support cases where the runtime applicationId (package name) differs from the Java/Kotlin class package, which commonly happens with productFlavors (e.g., test vs production builds).

Changes:

  • Derive a classPackageName from the host Activity class and use it when building component class names.
  • Update change() and reset() to enable/disable icon components using the class package rather than the runtime package name.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


pm.setComponentEnabledSetting(
new ComponentName(this.packageName, this.packageName + "." + enableName),
new ComponentName(this.packageName, this.classPackageName + "." + enableName),
Comment on lines +35 to +41
var fullClassName = activity.getClass().getName();
int lastDot = fullClassName.lastIndexOf('.');
if (lastDot != -1) {
this.classPackageName = fullClassName.substring(0, lastDot);
} else {
this.classPackageName = "";
}
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