Fatima
Fatima

Reputation: 869

Change the package name returned by mContext.getPackageName()

I have an app and I want to re-brand it. This is my code for sharing intent:

String shareBody = "https://play.google.com/store/apps/details?id=" + mContext.getPackageName();
            Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND);
            sharingIntent.setType("text/plain");
            sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, mContext.getResources().getString(R.string.enjoy_this_app));
            sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, shareBody);
            mContext.startActivity(Intent.createChooser(sharingIntent, "Please Choose"));

I have changed the package name EVERY WHERE in the project but still the mContext.getPackageName() returns the old name. (the package name is changed in manifest, gradle files, from project pane...)

I checked many posts here and I did everything recommended. Nothing worked. Posts I checked:

Android Studio Rename Package How to change package name of an Android Application How to change package name in android studio? Android Studio Rename Package

any idea what is going wrong?

thanks in advance.

Upvotes: 2

Views: 510

Answers (1)

AgentP
AgentP

Reputation: 7220

Well I Came with the similar issue even though I changed the package name Still it was giving me the old package...

To fix it Go to build.gradle file and replace applicationId manually to your new package name. This was not affected by renaming the package

Upvotes: 1

Related Questions