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

Overview

DownloadInstaller

App 应用内下载更新,希望小而美。更多需求请提Issues

Github :https://github.com/AnyLifeZLB/DownloadInstaller

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

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

使用 (1.1.2 版本后支持AndroidX 了)

首先 Gradle 引入(1.1.1 版本是最后一个support 版本,后面是AndroidX了)

Jcenter(): implementation 'anylife.downloadinstaller:downloadInstaller:1.1.3'
mavenCentral(): implementation 'io.github.anylifezlb:downloadInstaller:2.0.0'

Jcenter 服务供应商已经停止服务了,建议尽快迁移mavenCentral

然后 targetSDK>= 26

  //一般的弹出对话框提示升级
  //如果是企业内部应用升级,肯定是要这个权限; 其他情况不要太流氓,TOAST 提示
   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

You might also like...
Android Data Managment System Android UI - Kotlin- Firebase
Android Data Managment System Android UI - Kotlin- Firebase

DataManagmentSystem Data Managment System Android UI - Kotlin- Firebase Android Data Managment System App Design And Kotlin with Firebase The project

Tictactoe-android-app - Simple TicTacToe Android app written in Kotlin
Tictactoe-android-app - Simple TicTacToe Android app written in Kotlin

TicTacToe Android App This is a simple example of TicTacToe game as Android app

Android login spring - Android login against spring backend

Android Jetpack Compose login implementation with JWT tokens against our own bac

Movie Android App written in Kotlin, MVVM, Clean Architechture, Modularized, Coroutines, Android Architecture Components and Hilt
Movie Android App written in Kotlin, MVVM, Clean Architechture, Modularized, Coroutines, Android Architecture Components and Hilt

Movie Android App written in Kotlin, MVVM, Clean Architechture, Modularized, Coroutines, Android Architecture Components and Hilt.

Android library to help enter, and more importantly, leave, android "Immersive Mode".

Immersive Lock Android has various ways to full screen an application including locking the screen to prevent accidentally leaving the app. This is pa

Proxidize Android - Create 5G/4G Mobile Proxies on Android Phones
Proxidize Android - Create 5G/4G Mobile Proxies on Android Phones

Proxidize Android is an Android application that allows anyone to create a 5G or 4G mobile proxy using their phone. Learn more about Proxidize on https://proxidize.com/

Use Android Jetpack libraries, Android Architecture Components, ViewModel and LiveData to build this app.

Unscramble App Starter code for Android Basics codelab - Store the data in a ViewModel Unscramble is a single player game app that displays scrambled

Fully customizable, built from scratch NumberPicker for android. Created as an alternative to non-customizable native android NumberPicker
Fully customizable, built from scratch NumberPicker for android. Created as an alternative to non-customizable native android NumberPicker

GoodNumberPicker GoodPicker is an Android library that provides a picker with customizable UI. It was developed as alternative to the default NumberPi

🃏 Multimodular Android MVVM Template I use whenever I start a new Android Project.

Android architecture starter template This template is compatible with the latest stable version of Android Studio. Features Room Database Hilt ViewMo

Comments
  • 下载链接重定向的问题

    下载链接重定向的问题

    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 进行网络请求的处理,其内部会自动完成上述过程。

    opened by REBOOTERS 3
  • com.zenglb.downloadinstaller.fileprovider (in package com.xxxx.xxx) is already used by

    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.

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

    opened by enjoy-life-5 1
  • Could not find com.github.bbssyyuui:ActivityLauncher:1.0.2.

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

    Could not find com.github.bbssyyuui:ActivityLauncher:1.0.2. Searched in the following locations:

    • https://dl.google.com/dl/android/maven2/com/github/bbssyyuui/ActivityLauncher/1.0.2/ActivityLauncher-1.0.2.pom
    • https://dl.google.com/dl/android/maven2/com/github/bbssyyuui/ActivityLauncher/1.0.2/ActivityLauncher-1.0.2.jar
    • https://jcenter.bintray.com/com/github/bbssyyuui/ActivityLauncher/1.0.2/ActivityLauncher-1.0.2.pom
    • https://jcenter.bintray.com/com/github/bbssyyuui/ActivityLauncher/1.0.2/ActivityLauncher-1.0.2.jar Required by: project :TigerJump > anylife.downloadinstaller:downloadInstaller:1.1.1

    请问是什么问题

    opened by neo-godlike 0
Releases(2.3.0)
Owner
Felix
微信号:IWillGoneWithTheWind
Felix
Aggregated Android news, articles, podcasts and conferences about Android Development

DroidFeed Curated news feed for Android Developers! Stay up to date with the latest Android Development news. Built for the Android developer communit

Dogan Gulcan 183 Dec 2, 2022
Shreyas Patil 2.2k Jan 4, 2023
🎓 Learning Kotlin Coroutines for Android by example. 🚀 Sample implementations for real-world Android use cases. 🛠 Unit tests included!

Kotlin Coroutines - Use Cases on Android ?? Learning Kotlin Coroutines for Android by example. ?? Sample implementations for real-world Android use ca

Lukas Lechner 2.1k Jan 3, 2023
🔥The Android Startup library provides a straightforward, performant way to initialize components at the application startup. Both library developers and app developers can use Android Startup to streamline startup sequences and explicitly set the order of initialization.

??The Android Startup library provides a straightforward, performant way to initialize components at the application startup. Both library developers and app developers can use Android Startup to streamline startup sequences and explicitly set the order of initialization.

Rouse 1.3k Dec 30, 2022
Android Kotlin Fundamentals 01.2: Anatomy of Basic Android Project

Welcome to Android Kotlin Fundamentals 01.2: Anatomy of Basic Android Project ?? Codelab de android para practicar apps Android con Kotlin ?? Homepage

null 0 Oct 23, 2021
Meu primeiro aplicativo Android desenvolvido com Kotlin e Android Studio.

Cálculos 3 em 1 Este é um aplicativo Android que oferece três tipos de cálculos: calcular o IMC, calcular o valor do IPVA e converter medidas. Esse ap

Viviane Bresolin 0 Oct 30, 2021
Use Android Data Binding wih Live Data to glue View Model and Android

Gruop-C Spliff Summary Use Android Data Binding wih Live Data to glue View Model and Android. Asynchronous communications implemented with KotlinX Cor

null 2 Nov 21, 2021
DogglersApp - Criação de um App para estudo de RecyclerView no Android Studio. Parte do curso Android Basics in Kotlin

Dogglers - Starter Code Starter code for the second independent project for Android Basics in Kotlin. Introduction This is the starter code for the Do

Gustavo Zanardi dos Reis 0 Jan 20, 2022
Basic-Android-Project - A Basic Android Project with proper structure and all necessary dependencies

Basic-Android-Project A Basic Android Project with proper structure and all nece

Ameer Hamza 2 Mar 18, 2022