Giter Site home page Giter Site logo

anylifezlb / downloadinstaller Goto Github PK

View Code? Open in Web Editor NEW
281.0 8.0 51.0 2.97 MB

Android App应用内更新的下载,储存,安装 ,未知来源等问题处理,已适配Android 5-12

Java 88.99% Shell 0.69% Kotlin 10.32%
download install installer unkownsource

downloadinstaller's Introduction

DownloadInstaller

Android 应用内下载,储存,安装 ,未知来源等问题处理

  • 处理好了全局FileProvider,未知来源授权确认,通知栏等问题处理。
  • 已经下载的文件不会重复下载
  • 特别是Android 8 首次安装时候的未知来源问题处理,这里的处理方式很强硬,不授权安装未知来源就会一直跳转到授权页面,企业级别的App应用内更新很实用
  • 当然这是可以配置是否需要强制授权安装未知来源 参考:new DownloadInstaller(mContext, downloadUrl, isForceGrantUnKnowSource
  • 2.3.0 目前targetSdkVersion=33,已经适配Android 5-12

使用

首先 Gradle 引入

implementation 'io.github.anylifezlb:DownloadInstaller:2.3.0'

1.1.1 版本是最后一个support 版本,后面是AndroidX了
2.3.0 开始已经适配存储分区了和更改包名路径,请大家验证是否符合自己的项目需求后进行更新

  //一般的弹出对话框提示升级
  //如果是企业内部应用升级,大部分都希望升级; 其他情况请给予用户选择的自由,尊重用户。
   new DownloadInstaller(mContext, downloadUrl, isForceGrantUnKnowSource,new DownloadProgressCallBack() {
       @Override
       public void downloadProgress(int progress) {
             Log.e("PROGRESS","Progress"+progress);
       }
  
       @Override
       public void downloadException(Exception e) {
             e.printStackTrace();
       }
  

       @Override
       public void onInstallStart() {
  
       }
   }).start();
   

. More,Contact me : [email protected]

image.png

image.png

downloadinstaller's People

Contributors

anylifezlb avatar faceai avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

downloadinstaller's Issues

位置应用安装授权

和一楼有点像,是如果我没有勾选就无法返回,友好的处理是可以返回,只是返回后Toast 提示,然后呢!用户再次点击的时候跳转哪里去授权才好

下载链接重定向的问题

DownApkRunnable 中使用 HttpURLConnection 进行网络请求,没有处理下载链接存在重定向的情况(很多时候会根据下载地址重定向到一个 CDN 的地址)。这个时候返回的 response 并不是一个实际的 apk 流,而是一次重定向的内容,建议对 resonse code 做一次判断,类似下面这种

            val conn = connectionUrl.openConnection() as HttpURLConnection
            conn.connect()

            if (conn.responseCode == 302) {
                val redirectUrl = conn.getHeaderField("Location")
           。。。。。
          }

或者使用 OkHttp 进行网络请求的处理,其内部会自动完成上述过程。

com.zenglb.downloadinstaller.fileprovider (in package com.xxxx.xxx) is already used by

Installation failed with message Failed to finalize session : INSTALL_FAILED_CONFLICTING_PROVIDER: Package couldn't be installed in /data/app/com.zxxxxx.xxx==: Can't install because provider name com.zenglb.downloadinstaller.fileprovider (in package com.zjxxxx.xx) is already used by com.xxxx.xxx.
It is possible that this issue is resolved by uninstalling an existing version of the apk if it is present, and then re-installing.

楼主,项目换了个包名,然后重新打包安装的时候,会出现这个问题,怎么解决?

Could not find com.github.bbssyyuui:ActivityLauncher:1.0.2.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.