简体   繁体   English

直接下载并安装android apk

[英]Direct download and install of a android apk

I developed a android app which is not in the playstore because its just for internal use. 我开发了一个Android应用程序,它不在Playstore中,因为它仅供内部使用。 So i made a download page where the user can download the apk. 所以我做了一个用户可以下载apk的下载页面。 The problem is, after download, the user is not able to install the apk. 问题是,下载后,用户无法安装apk。

Its just possible if the user uses for example "Astro Filemanager". 如果用户使用例如“Astro Filemanager”,它就是可能的。 But i found the download page from the amazon app store apk: https://www.amazon.de/gp/mas/get/android/ref=mas_rw_ldg and if i download the apk i can install it directly with a click in the download notification. 但我发现从亚马逊应用程序商店的下载页面apk: https//www.amazon.de/gp/mas/get/android/ref=mas_rw_ldg如果我下载apk我可以直接安装它点击下载通知。

So i tried the find out what the differences between my apk and the amazon apk is. 所以我试着找出我的apk和亚马逊apk之间的区别是什么。 So i used "aapt dumb badging {pathToAPK}" to check the 2 files. 所以我用“aapt dumb badging {pathToAPK}”检查了2个文件。

The Amazon File: 亚马逊文件:

package: name='com.amazon.venezia' versionCode='638000510' versionName='release-8.0005.557.1C_638000510'
sdkVersion:'8'
targetSdkVersion:'17'
uses-permission:'android.permission.GET_TASKS'
uses-permission:'android.permission.READ_LOGS'
uses-permission:'android.permission.INTERACT_ACROSS_USERS_FULL'
uses-permission:'com.amazon.mas.client.GLOBAL_BROADCAST'
uses-permission:'android.permission.INSTALL_PACKAGES'
uses-permission:'android.permission.DELETE_PACKAGES'
uses-permission:'com.android.amazon.dcp.ota.permission.INSTALL_PACKAGES'
uses-permission:'com.amazon.mas.client.install.CONTENT_PROVIDER_WRITE'
uses-permission:'com.amazon.mas.client.install.INSTALL'
uses-permission:'com.amazon.mas.client.install.KICKOFF_INSTALL'
uses-permission:'com.amazon.mas.client.install.RECEIVE_INSTALL_STATE'
uses-permission:'android.permission.INTERNET'
uses-permission:'android.permission.WRITE_EXTERNAL_STORAGE'
uses-permission:'android.permission.ACCESS_NETWORK_STATE'
uses-permission:'android.permission.WAKE_LOCK'
uses-permission:'com.amazon.inapp.purchasing.Permission.NOTIFY'
uses-permission:'com.amazon.device.iap.physical.Permission.NOTIFY'
uses-permission:'com.amazon.mas.client.authentication.permission.DEREGISTRATION_BROADCAST_PERMISSION'
uses-permission:'com.amazon.mas.client.CONTENT_PROVIDER_READ'
uses-permission:'com.amazon.mas.client.malware.blockedapp.BLOCKED_APP_PROVIDER_WRITE'
application-label:'Appstore'
application-label-ja:'Apps'
application-label-de:'App-Shop'
application-label-zh:'亚马逊应用商店'
application-label-en:'Appstore'
application-label-fr:'App-Shop'
application-label-es:'Tienda Apps'
application-label-it:'App-Shop'
application-label-pt:'Appstore'
application-label-fr_CA:'Appstore'
application-icon-120:'res/drawable-ldpi/icon.png'
application-icon-160:'res/drawable-mdpi/icon.png'
application-icon-240:'res/drawable-hdpi/icon.png'
application-icon-320:'res/drawable-xhdpi/icon.png'
application-icon-480:'res/drawable-xhdpi/icon.png'
application: label='Appstore' icon='res/drawable-mdpi/icon.png'
launchable-activity: name='com.amazon.venezia.Venezia'  label='' icon=''
uses-library-not-required:'com.amazon.webview'
uses-library-not-required:'com.amazon.dcp.contracts'
uses-library-not-required:'com.amazon.dcp.contracts.framework'
uses-library-not-required:'com.amazon.client.metrics.api'
uses-permission:'com.amazon.dcp.metrics.permission.METRICS_PERMISSION'
uses-permission:'com.amazon.dcp.config.permission.DYN_CONFIG_VALUES_UPDATED'
uses-permission:'com.amazon.dcp.settings.permission.READ_SETTINGS'
uses-permission:'android.permission.GET_ACCOUNTS'
uses-permission:'android.permission.USE_CREDENTIALS'
uses-permission:'android.permission.MANAGE_ACCOUNTS'
uses-permission:'android.permission.AUTHENTICATE_ACCOUNTS'
uses-permission:'com.amazon.identity.auth.device.perm.AUTH_SDK'
uses-permission:'com.amazon.identity.permission.GENERIC_IPC'
uses-permission:'com.amazon.dcp.sso.permission.USE_DEVICE_CREDENTIALS'
uses-permission:'com.amazon.dcp.sso.permission.EXPIRE_ACCESS_TOKEN'
uses-permission:'com.amazon.dcp.sso.permission.account.changed'
uses-permission:'com.amazon.dcp.sso.permission.MANAGE_COR_PFM'
uses-permission:'com.amazon.dcp.sso.permission.CUSTOMER_ATTRIBUTE_SERVICE'
uses-permission:'com.amazon.identity.permission.CAN_CALL_MAP_INFORMATION_PROVIDER'
uses-permission:'amazon.permission.COLLECT_METRICS'
uses-permission:'android.permission.ACCESS_WIFI_STATE'
uses-permission:'android.permission.READ_EXTERNAL_STORAGE'
uses-implied-permission:'android.permission.READ_EXTERNAL_STORAGE','requested WRITE_EXTERNAL_STORAGE'
uses-feature:'android.hardware.wifi'
uses-implied-feature:'android.hardware.wifi','requested android.permission.ACCESS_WIFI_STATE, android.permission.CHANGE_WIFI_STATE, or android.permission.CHANGE_WIFI_MULTICAST_STATE permission'
uses-feature:'android.hardware.touchscreen'
uses-implied-feature:'android.hardware.touchscreen','assumed you require a touch screen unless explicitly made optional'
uses-feature:'android.hardware.screen.portrait'
uses-implied-feature:'android.hardware.screen.portrait','one or more activities have specified a portrait orientation'
main
other-activities
other-receivers
other-services
supports-screens: 'small' 'normal' 'large' 'xlarge'
supports-any-density: 'true'
locales: '--_--' 'ja' 'de' 'zh' 'en' 'fr' 'es' 'it' 'pt' 'fr_CA'
densities: '120' '160' '240' '320' '480'
native-code: 'armeabi'

And my File: 我的档案:

package: name='mypackage' versionCode='41' versionName='5.1'
sdkVersion:'8'
targetSdkVersion:'17'
uses-permission:'android.permission.INTERNET'
uses-permission:'android.permission.READ_PHONE_STATE'
uses-permission:'android.permission.ACCESS_NETWORK_STATE'
uses-permission:'android.permission.GET_ACCOUNTS'
uses-permission:'android.permission.READ_CONTACTS'
uses-permission:'android.permission.ACCESS_FINE_LOCATION'
uses-permission:'com.google.android.c2dm.permission.RECEIVE'
uses-permission:'mypackage.permission.C2D_MESSAGE'
application-label:'Just for fun'
application-label-da:'Just for fun'
application-label-nb:'Just for fun'
application-label-de:'Just for fun'
application-label-he:'Just for fun'
application-label-se:'Just for fun'
application-label-fi:'Just for fun'
application-label-en:'Just for fun'
application-label-fr:'Just for fun'
application-label-es:'Just for fun'
application-label-it:'Just for fun'
application-label-pt:'Just for fun'
application-label-iw:'Just for fun'
application-icon-120:'res/drawable-ldpi/icon_android.png'
application-icon-160:'res/drawable/icon_android.png'
application-icon-240:'res/drawable/icon_android.png'
application-icon-320:'res/drawable/icon_android.png'
application: label='Just for fun' icon='res/drawable/icon_android.png'
launchable-activity: name='mypackage.MainActivity'  label='Just for fun' icon=''
uses-feature:'android.hardware.location'
uses-implied-feature:'android.hardware.location','requested a location access permission'
uses-feature:'android.hardware.location.gps'
uses-implied-feature:'android.hardware.location.gps','requested android.permission.ACCESS_FINE_LOCATION permission'
uses-feature:'android.hardware.touchscreen'
uses-implied-feature:'android.hardware.touchscreen','assumed you require a touch screen unless explicitly made optional'
uses-feature:'android.hardware.screen.portrait'
uses-implied-feature:'android.hardware.screen.portrait','one or more activities have specified a portrait orientation'
main
other-activities
other-receivers
supports-screens: 'small' 'normal' 'large' 'xlarge'
supports-any-density: 'true'
locales: '--_--' 'da' 'nb' 'de' 'he' 'se' 'fi' 'en' 'fr' 'es' 'it' 'pt' 'iw'
densities: '120' '160' '240' '320'

But i have no idea was the difference is. 但我不知道差异是什么。 My file is signed with our key. 我的文件是用我们的密钥签名的。

Ok. 好。 I guess i fixed it. 我想我修好了。 The problem was the mime-type of the download. 问题是下载的mime类型。 I changed it from force-download to application/vnd.android.package-archive and now it works. 我将它从强制下载更改为application / vnd.android.package-archive,现在它可以工作了。

There may be an alternative to trying to handle the download, install, and updating of an app yourself. 尝试自己处理应用程序的下载,安装和更新可能有其他选择。 The Google Play Store allows alpha and beta versions (without having a production version) of an app which is only available to a select group of people (defined by a Google+ circle or Google Group). Google Play商店允许使用仅适用于特定人群(由Google+圈子或Google网上论坛定义)的应用的Alpha和Beta版本(没有生产版本)。 You'll still have to sign the app and meet some basic requirements for content (eg correct icons and graphics), but you can keep a distribution closed. 您仍然需要签署应用程序并满足内容的一些基本要求(例如正确的图标和图形),但您可以保持关闭分发。 You'll still have the advantages of the Play Store (automatic updates, trusted install source, etc.) but it will be completely invisible to anyone who is not part of the beta group. 您仍将拥有Play商店的优势(自动更新,可信安装源等),但对于不属于测试版组的任何人来说,它都是完全不可见的。

The trusted install source will also help get around having to have users manually enable non-Market sources for download and install which may be why users' devices aren't allowing the installation of the app. 受信任的安装源还有助于让用户手动启用非市场资源下载和安装,这可能是用户设备不允许安装应用程序的原因。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM