0

I have that vulnerability according to google play console. It's supposed that the solution is to add .setPackage() or .setClassName() to the intent but now the activity is not being recognized. How can I use this function? The intent as it was with the vulnerability is this:

@Override
    public void onBackPressed() {
        super.onBackPressed();
        Intent intent = new Intent("independent.dev.ui.mainactivity");
        intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
        startActivity(intent);
    }

The solution that I tried adding the package name:

@Override
    public void onBackPressed() {
        super.onBackPressed();
        Intent intent = new Intent("independent.dev.ui.mainactivity");
        intent.setPackage("independent.dev.ui.Activities");
        intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
        startActivity(intent);
    }

my AndroidManifest.xml is this

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="independent.dev.ui.Activities">
.
.
.
<activity
            android:name=".MainActivity"
            android:configChanges="orientation|keyboardHidden"
            android:label="Menu Principal"
            android:screenOrientation="portrait">
            <intent-filter>
                <action android:name="independent.dev.ui.mainactivity" />

                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>

How can I set the package so I can navigate and delete this vulnerability?

3
  • Is independent.dev.ui.Activities your applicationId, as set in your Gradle build scripts? Commented May 1, 2022 at 20:56
  • No, mi aaplicationId is another one. But isn't it supposed that I have to set the package name? Commented May 2, 2022 at 14:26
  • 2
    Despite the name, setPackage() takes an applicationId. Commented May 2, 2022 at 15:10

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.