How does an application work to enable paid features of another application?

There are applications (such as https://play.google.com/store/apps/details?id=com.teslacoilsw.launcher ) that are free, but paid features can be activated by purchasing another application (in this case, this https://play.google.com/store/apps/details?id=com.teslacoilsw.launcher.prime )

How it works?

I assume that free applications run an explicit intention and can determine if the application is present through a try / catch structure. The disadvantage of this is that it can be easily bypassed by someone who creates an application with the same package name and indicates all possible Intent filters.

Is this how it works, or is it some other way?

+5
source share
2 answers

The easiest way is to use startActivityForResult(...) from application A regarding the action of application B, which must be configured using IntentFilter for use from an external application. You can also check who is calling using getCallingActivity() . You can find an example here .

Before starting an Activity, you can verify that B is installed (using the PackageManager), or you can just get started and catch the Exception.

In the called activity, you can verify the signature of the calling package using the PackageManager.checkSignature (String, String) method . Pass the package name A and B, and if the signature matches, follow the logic.

0
source

There are various ways to do this. One way is to request a content provider that will be protected by special permission.

I recently released a Github library that helps to do this: Android Unlocker Library .

However, it’s a good option if you are dealing with devices outside the Google ecosystem, however, thanks to the experience of the developers, in-app purchases offer a much better user experience (and therefore stimulate more sales) for me.

+2
source

Source: https://habr.com/ru/post/1240571/


All Articles