There is a prerequisite for you to do this function, that is, your application has been installed on the user’s machine. This means that you can only do this when upgrading your APK, because the function you want to perform requires your own program. Cooperate, the specific steps are as follows:
First of all, you need to know that the program has been installed, so you need to register a broadcast listener in your own program (it must be static, you know). The action for apk installation completion: "android.intent.action.PACKAGE_ADDED ", listen to the action in the onReceive method of this broadcast, and use the intent.getDataString() method to determine whether the package name of the installation program belongs to your own package name, and if so, do the next step;
Start your own program explicitly or implicitly through Intent.
Recommendation:
It’s best not to do this. You have to consider the user’s feelings, especially the automatic installation. When you don’t need to click to confirm, you are playing games, watching videos, reading novels, or using WeChat to automatically open an application. . . .
There is a prerequisite for you to do this function, that is, your application has been installed on the user’s machine. This means that you can only do this when upgrading your APK, because the function you want to perform requires your own program. Cooperate, the specific steps are as follows:
First of all, you need to know that the program has been installed, so you need to register a broadcast listener in your own program (it must be static, you know). The action for apk installation completion: "android.intent.action.PACKAGE_ADDED ", listen to the action in the onReceive method of this broadcast, and use the intent.getDataString() method to determine whether the package name of the installation program belongs to your own package name, and if so, do the next step;
Start your own program explicitly or implicitly through Intent.
Recommendation:
It’s best not to do this. You have to consider the user’s feelings, especially the automatic installation. When you don’t need to click to confirm, you are playing games, watching videos, reading novels, or using WeChat to automatically open an application. . . .