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);
        }
    }

  • 相关阅读:
    [AGC020E] Encoding Subsets
    [Topcoder16346]TwoPerLine
    CF913E Logical Expression
    英语面试
    CRM
    WEB使用第三方支付服务大致流程
    OO语言 prototype 初级用法
    flash设置字体
    air 提示问题
    c#里的BYTE
  • 原文地址:https://www.cnblogs.com/melons/p/5791944.html
Copyright © 2011-2022 走看看