偷偷摘套内射激情视频,久久精品99国产国产精,中文字幕无线乱码人妻,中文在线中文a,性爽19p

Android安裝卸載程序具體操作方法解析

移動(dòng)開發(fā) Android
Android安裝卸載程序在實(shí)際應(yīng)用中是一個(gè)比較基本的操作。作為初學(xué)者來(lái)說(shuō)需要牢固掌握這一應(yīng)用技巧,以方便我們的使用。

對(duì)于編程愛好者們來(lái)說(shuō),Android手機(jī)操作系統(tǒng)是一款非常實(shí)用的系統(tǒng)。他們可以進(jìn)行各種Android應(yīng)用程序的開發(fā)來(lái)滿足自的應(yīng)用需求。在這里我們就先來(lái)為大家講解一下有關(guān)Android安裝卸載程序的具體操作步驟。

在Android安裝卸載程序的源碼中我們知道:

  1. < activity android:name=".PackageInstallerActivity">   
  2. < intent-filter>   
  3. < action android:name="android.intent.action.VIEW" />   
  4. < category android:name="android.intent.category.DEFAULT" />   
  5. < data android:scheme="content" />   
  6. < data android:scheme="file" />   
  7. < data android:mimeType="application/vnd.android.package-archive" />   
  8. < /intent-filter>   
  9. < /activity>   
  10. < activity android:name=".UninstallerActivity">   
  11. < intent-filter>   
  12. < action android:name="android.intent.action.VIEW" />   
  13. < action android:name="android.intent.action.DELETE" />   
  14. < category android:name="android.intent.category.DEFAULT" />   
  15. < data android:scheme="package" />   
  16. < /intent-filter>   
  17. < /activity> 

因?yàn)楦鶕?jù)里面的權(quán)限我們可以 安裝一個(gè)程序從sd卡:

  1. String fileName = Environment.getExternalStorageDirectory() 
    + "/myApp.apk";   
  2. Intent intent = new Intent(Intent.ACTION_VIEW);   
  3. intent.setDataAndType(Uri.fromFile(new File(fileName)), 
    "application/vnd.android.package-archive");   
  4. startActivity(intent);  

Android安裝卸載程序的操作中要想卸載一個(gè)程序;

  1. Uri packageURI = Uri.parse("package:com.android.myapp");   
  2. Intent uninstallIntent = new Intent
    (Intent.ACTION_DELETE, packageURI);   
  3. startActivity(uninstallIntent);  

默認(rèn)是不支持安裝非市場(chǎng)程序的 因此判斷一下

  1. int result = Settings.Secure.getInt(getContentResolver(),
     Settings.Secure.INSTALL_NON_MARKET_APPS, 0);   
  2. if (result == 0) {   
  3. // show some dialog here   
  4. // ...   
  5. // and may be show application settings dialog manually   
  6. Intent intent = new Intent();   
  7. intent.setAction(Settings.ACTION_APPLICATION_SETTINGS);   
  8. startActivity(intent);   

Android安裝卸載程序的具體實(shí)現(xiàn)方法就為大家介紹到這里。

【編輯推薦】

  1. Android Jni代碼示例講解 
  2. Android單元測(cè)試源碼解讀 
  3. Android判斷網(wǎng)絡(luò)狀態(tài)方法詳解 
  4. Android程序架構(gòu)基本內(nèi)容概述 
  5. Android調(diào)用平臺(tái)功能具體技巧分享 
責(zé)任編輯:曹凱 來(lái)源: javaeye.com
相關(guān)推薦

2009-12-30 16:48:52

Silverlight

2010-02-02 13:57:31

C++解析#pragm

2010-01-27 18:00:57

Android開機(jī)自啟

2010-02-02 17:13:35

C++ Endian

2010-04-02 08:42:32

Oracle 游標(biāo)

2010-02-03 13:26:53

C++計(jì)時(shí)

2010-03-05 15:27:06

Python文件路徑

2010-04-13 17:00:27

Oracle NLS_

2010-01-07 15:37:35

VB.NET ForNext循環(huán)

2010-02-02 16:23:46

C++實(shí)現(xiàn)WPF動(dòng)畫

2010-03-19 14:19:58

Python正則表達(dá)式

2010-03-05 17:06:26

Python顯示UTF

2009-12-10 13:35:25

Linux操作系統(tǒng)

2009-12-30 15:47:40

Silverlight

2011-03-17 09:06:58

iptables映射端口

2009-08-31 13:32:38

C#創(chuàng)建XML文件

2010-01-05 16:02:36

Ubuntu Git

2009-09-10 14:49:00

2010-05-14 14:46:38

MySQL手動(dòng)安裝

2009-12-31 15:36:13

SilverLight
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)