0

I have constants set up for my Flavor names:

public static final String FLAVOR_NAME_PRO = "pro";
public static final String FLAVOR_NAME_FREE = "free";

Inside my Activity's onCreate() I assign the boolean mUsingProFlavor a value:

    mUsingProFlavor = BuildConfig.FLAVOR.equals(FLAVOR_NAME_PRO);

In a clickListener created later on I have this:

if (mUsingProFlavor) {
     customerId = getCustomerId();
     Intent intent = new Intent(MainActivity.this, CustomerProfileActivity.class);
                    intent.putExtra("customerId", customerId);
                    startActivity(intent);
   } else {
        showProOnlyFeatureAlertDialog(MainActivity.this, mAlertDialog);
   }

This is the only way for the user to access CustomerProfileActivity, and yet somehow I'm getting crash reports indicating that one of my Free users is crashing inside of CustomerProfileActivity.

Any idea how this could happen?

Gavin Wright
  • 3,124
  • 3
  • 14
  • 35
  • (Disclaimer: I'm not an Android person, but) [hacking](https://stackoverflow.com/questions/12370326/decompile-an-apk-modify-it-and-then-recompile-it) might be one semi-obvious way. – Amadan Sep 07 '18 at 05:18
  • @Amadan The weird thing is he also owns the Pro version. I can tell because he's the only user who's causing certain crashes on both versions. If he already own it there's no reason to crack it. He could simply pass the APK around if he wanted to share it. – Gavin Wright Sep 07 '18 at 05:21
  • 1
    using ADB, you can start any activity of the app. Sobasically, user can start `CustomerProfileActivity.class` using adb command – Vladyslav Matviienko Sep 07 '18 at 05:22
  • @VladyslavMatviienko I guess he could be doing this, but since he seems to own the Pro version I'm not sure why he'd bother. – Gavin Wright Sep 07 '18 at 05:24
  • did you keep in app purchase for getting paid version ? , rooted phones can bypass in app purchases – Manohar Sep 07 '18 at 05:35
  • @Redman They're separate APKs. Also, Crashlytics reports the device as not being rooted. – Gavin Wright Sep 07 '18 at 05:37
  • @VladyslavMatviienko It would explain this related issue I'm having: https://stackoverflow.com/questions/52214960/intent-extras-are-not-being-delivered-on-a-specific-device . If he's poking around in ADB the intent extras wouldn't be sent as normal. – Gavin Wright Sep 07 '18 at 05:38
  • Seperate apks ? then its even more easy , there are many external sites which provide paid apps for free – Manohar Sep 07 '18 at 05:38
  • @Redman I honestly don't care if he pirated it. I just want to know how he's in that activity while in the free version. – Gavin Wright Sep 07 '18 at 05:40
  • 1
    `intent extras` that is *probably* the reason of crash – Vladyslav Matviienko Sep 07 '18 at 05:41

1 Answers1

-2
if (mUsingProFlavor) {
 customerId = getCustomerId();
 Intent intent = new Intent(MainActivity.this, CustomerProfileActivity.class);
                intent.putExtra("customerId", customerId);
                startActivity(intent);
 } else {
    showProOnlyFeatureAlertDialog(MainActivity.this, mAlertDialog);
}

Your -> if(mUsingProFlavor) is the issue here. Since mUsingProFlavor is a String, you have to modify your if-check. Currently it is acting as boolean.

if (mUsingProFlavor.equals("pro")) {
 customerId = getCustomerId();
 Intent intent = new Intent(MainActivity.this, CustomerProfileActivity.class);
                intent.putExtra("customerId", customerId);
                startActivity(intent);
 } else {
    showProOnlyFeatureAlertDialog(MainActivity.this, mAlertDialog);
}
Abdul Ahad
  • 435
  • 4
  • 14