Get the App
SLTechnology News&Howtos  ›  Development  › 

The concrete operation method of Android installation and uninstall program

Shulou Source: shulou.com Published: 2022-06-02 16:02:24 09月29日 Update

Android installation and uninstall the specific operation of the program, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain in detail for you, people with this need can come to learn, I hope you can gain something.

For programming enthusiasts, the Android mobile operating system is a very practical system. They can develop various Android applications to meet their own application needs. Here we will first explain to you the specific steps of installing and uninstalling the Android program.

In the source code of the Android installation uninstaller, we know:

< activity android:name=".PackageInstallerActivity">

< intent-filter>

< action android:name="android.intent.action.VIEW" />

< category android:name="android.intent.category.DEFAULT" />

< data android:scheme="content" />

< data android:scheme="file" />

< data android:mimeType="application/vnd.android.package-archive" />

< /intent-filter>

< /activity>

< activity android:name=".UninstallerActivity">

< intent-filter>

< action android:name="android.intent.action.VIEW" />

< action android:name="android.intent.action.DELETE" />

< category android:name="android.intent.category.DEFAULT" />

< data android:scheme="package" />

< /intent-filter>

< /activity>

Because according to the permissions inside, we can install a program from the SD card:

String fileName = Environment.getExternalStorageDirectory ()

+ "/ myApp.apk"

Intent intent = new Intent (Intent.ACTION_VIEW)

Intent.setDataAndType (Uri.fromFile (new File (fileName)

"application/vnd.android.package-archive")

StartActivity (intent)

To uninstall a program during the Android installation and uninstaller operation

Uri packageURI = Uri.parse ("package:com.android.myapp")

Intent uninstallIntent = new Intent

(Intent.ACTION_DELETE, packageURI)

StartActivity (uninstallIntent)

Installation of non-market programs is not supported by default, so judge

Int result = Settings.Secure.getInt (getContentResolver ()

Settings.Secure.INSTALL_NON_MARKET_APPS, 0)

If (result = = 0) {

/ / show some dialog here

/ /...

/ / and may be show application settings dialog manually

Intent intent = new Intent ()

Intent.setAction (Settings.ACTION_APPLICATION_SETTINGS)

StartActivity (intent)

}

Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.

Tags: Programs systems requirements help applications support methods practical clear operating systems content applications mobile phones articles novices more permissions steps source code Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Tech Info NVidia Shulou Technology OPPO Reno Shulou Information