Android checks whether the mobile phone has a method to install an application

This example describes the method of Android to check whether an application is installed on the mobile phone. Share with you for your reference, as follows:

Mobile phone users are particularly tired of manually inputting a large amount of information. Calling other programs or functions in one program can often give users a better user experience and make users feel more friendly. Therefore, such integration between programs can promote the "win-win" situation of multi-party software cooperation.

When we call other programs in our own program, we often check whether the mobile phone has installed the software and then do the corresponding operations. If there is no installation, we will use intent to boot the user to Android Market to download the program. If installed, we will open the program and import the parameters and call its functions.

The following describes how to judge that a program has been installed on the mobile phone:

The following is the logic after calling this method for judgment:

I wrote the above method myself. In addition, I checked the following method on the Internet. It is said that it is OK, but I have a problem when I use it. Maybe there is a problem with the parameters I pass in. The following two functions should pass in action and intent respectively. You can try it.

Method 1:

Method 2:

Then do the corresponding operation. If it is not installed, use intent to guide the user to the Android Market to download the program. If it is installed, open the program, pass in parameters and call its functions.

The following describes how to judge that a program has been installed on the mobile phone:

The following is the logic after calling this method for judgment:

I wrote the above method myself. In addition, I checked the following method on the Internet. It is said that it is OK, but I have a problem when I use it. Maybe there is a problem with the parameters I pass in. The following two functions should pass in action and intent respectively. You can try it.

Method 1:

For more Android related content, readers who are interested can view the topics on this site: summary of Android view skills, summary of activity operation skills of Android programming, summary of SQLite database skills for Android, summary of JSON format data skills for Android, summary of Android database operation skills, summary of Android file operation skills Summary of SD card operation methods for Android programming development, introduction and advanced tutorial for Android development, summary of Android resource operation skills and summary of Android control usage

I hope this article will help you in Android programming.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>