简体   繁体   中英

Android: Looking for a method to unlock hidden features in pre-installed version of our app

I am afraid this question is a bit more open ended but I hope this is justified by the fact that the situation is a bit unusual...

What we want to achieve

One of our apps will be pre-installed on upcoming Android phones distributed by a mobile carrier. However, in that pre-installed app some features should be unlocked that are not otherwise (for users who have installed the app from the Google Play Store) available. Something like an extended free trial period for a new paid subscription, for example.

What we've come up with so far

One option would of course be a special build of the app that enables the hidden features through some feature toggle. However, this special build would possibly be overwritten by an automatic update from the Play Store before the user has ever even opened the app.

So our best guess so far is to pre-install both the normal build of our main app AND some other app with no or minimal UI. The main app would then detect the presence of that other key app (through the package manager) and unlock the hidden features based on that.

AFAICT this was the way that free trials for paid apps were handled before Google In App Purchases supported non-consumable one-time products. And it should also still work as far as both apps are signed with the same key and, starting with Android 11, the main app declares the key in the AndroidManifest.xml .

Correct so far?

But...

Ideally the hidden features should only be able to be consumed once per device , ie the user should be able to claim the extended free trial only for one new subscription - and not for additional ones for their neighbour and their dog.

This is not a very strong requirement, so we were thinking of adding some communication between the main and key apps and that the key app would store the fact that the benefit had been claimed before. Of course, this could probably be circumvented by deleting the app data of the key app but it's better than nothing...

So, questions:

  • Is there a way to mostly/completely hide the key app from the user? So that the function of the key app would at least be somewhat obscured?
  • Is there any other method we are overlooking? Like, is there a way to set some kind of global variable in an Android image that the carrier could set for us - like com.exampleapp.unlock.hiddenfeature1 = true ? - and which we could query instead of checking for the presence of the key app ? This would probably still be susceptible to multiple uses but maybe there'd be a way to prohibit that, too?

What else?

From a technical standpoint, an obvious method would be to query the IMEI of the device (maybe for a pre-installed app that would still be possible?) and then either compare that to a list of eligible devices or at least keep track of the IMEIs for which the hidden feature had been claimed. But, of course, for data privacy reasons that's not possible.

So, I hope I made our goals clear and am very grateful for any advice, suggestions and input!

Context

  • Pre-Installed-App: PIA
  • Google-Play App: GPA .

Problems

  • PIA being a "Flavor"
  • PIA leveraging "Shared Preferences" to leave marks the GPA app can "pick up"
  • Any other form of "common ground".

The issue(s) with these is that you cannot avoid the various scenarios where this would fail, notably if the user never opens your app before it's replaced by a GPA update, or a simple SharedPreferences cleanup / reinstall.

Ideas?

Ideas are cheap, so take all of this with a grain of salt. I'm mostly thinking out loud because I find it to be an interesting problem.

  1. Have you considering some form of Licencing ? Eg: using the Google Play licencing

  2. Could a form ofdynamic delivery help you here?

  3. How about Having a PIA that is just a launcher for a special flavor of your app? (that the user can get via Instant apps ? The PIA won't be updated by the GPA because it won't be touched (and if it is, it's only touched by you, and yes, users could do it again, but then you'd be fighting about the impossible). You will have to accept that some users will "cheat". But by using the PlayStore and all these "features" you can always control much more stuff. Not sure if the Play store is something these new devices will have or not.

  4. Short of all this, you're going to have to handle this server-side yourself. Having an app where users "register" or request the trial, and take it from there.

I can't think of other ideas at this time.

I am not hunting for rep, feel free to pick a better response, but let us know what you chose to do. ;)

Umm, let me see if I understood you correctly.

You have this app on Google Play, and the same package will also be pre-installed on some devices. I assume you can control as to how this app is going to be installed on the devices. Meaning: The pre-installed ones will be a system app that cannot be removed from the phone. And, if you download it from the play store as an update where the app was pre-installed already on that device, it will remain as a system app.

You can basically tell which version of the app is installed on any device, with a basic check of this:

boolean isSystemApp = (getApplicationInfo() & ApplicationInfo.FLAG_SYSTEM) != 0

This simple call should tell you whether the app is pre-installed to the device or not. It's also not changed even if the user receives an update afterwards. If this flag is false, you can simply assume it's either side-loaded or installed from Google Play Store (without having it as pre-installed I mean).

You can open the features if the app is a system app, and close it otherwise.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM