zoukankan      html  css  js  c++  java
  • android 广播安装指定下载的apk

    // 广播出去,由广播接收器来处理下载完成的文件
      Intent sendIntent = new Intent("com.test.downloadComplete");
      // 把下载好的文件的保存地址加进Intent
      sendIntent.putExtra("downloadFile", file.getPath());
      sendBroadcast(sendIntent);

     <receiver android:name="com.yuxin.mhealth.ui.dbmanager.DownLoadBR" >
                <intent-filter>
                    <action android:name="com.test.downloadComplete" >
                    </action>
                </intent-filter>
            </receiver>

    public class DownLoadBR  extends BroadcastReceiver {
        @Override
        public void onReceive(Context context, Intent intent) {
            Intent install = new Intent(Intent.ACTION_VIEW);
            String pathString = intent.getStringExtra("downloadFile");
            install.setDataAndType(Uri.fromFile(new File(pathString)), "application/vnd.android.package-archive");
            install.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            context.startActivity(install);
        }
    }

  • 相关阅读:
    华为机试练习(一)
    LM拟合算法
    5.1 模块化程序设计
    第3周 运算的流程控制
    KEGG数据库介绍
    topGO
    GO.db
    Bioconductor应用领域之基因芯片
    org.Hs.eg.db包简介(转换NCBI、ensemble等数据库中基因ID,symbol等之间的转换)
    Bioconductor的历史
  • 原文地址:https://www.cnblogs.com/melons/p/5791944.html
Copyright © 2011-2022 走看看