简体   繁体   English

如何在android中不允许的情况下从内部存储安装应用程序?

[英]How to install an apps from internal storage while being not allowed in android?

I have developed a small utility application with an overlay view.我开发了一个带有覆盖视图的小型实用程序。 Problem is, after installing my application on the device, I cannot install any other apk from the internal storage.问题是,在设备上安装我的应用程序后,我无法从内部存储安装任何其他 apk。 I can install applications from google play, and via ADT.我可以从 google play 和通过 ADT 安装应用程序。 But it don't let me install from my own internal storage.但它不允许我从我自己的内部存储安装。 I am out of ideas.我没有想法。 Couldn't find a way to solve this problem.找不到解决此问题的方法。 Please help me out with ideas and workable codes.请帮助我提供想法和可行的代码。 Thanks in advance.提前致谢。 Here is the Menifest file I am using.这是我正在使用的 Menifest 文件。

    <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com._"
    android:versionCode="9"
    android:versionName="1.5" >

    <uses-sdk
        android:minSdkVersion="11"
        android:targetSdkVersion="19" />

    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
    <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.VIBRATE" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/winar"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.MainActivity"
            android:configChanges="orientation|screenSize"
            android:excludeFromRecents="true"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name="com.TransPerantActivity"
            android:configChanges="orientation|screenSize"
            android:excludeFromRecents="true"
            android:theme="@style/Theme.Transparent" >
        </activity>

        <service
            android:name="com.MyService"
            android:process=":my_process" >
        </service>
        <receiver
            android:name="com.NetworkChangeReceiver"
            android:label="NetworkChangeReceiver" >
            <intent-filter>
                <action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
                <action android:name="android.net.wifi.WIFI_STATE_CHANGED" />
                <action android:name="android.intent.action.BOOT_COMPLETED" />
            </intent-filter>
        </receiver>
        <activity
            android:name="com.waltonbd.networkmonitor.Update"
            android:label="@string/title_activity_update" >
        </activity>
        <activity
            android:name="com.waltonbd.networkmonitor.About"
            android:label="@string/title_activity_about"
            android:theme="@android:style/Theme.Light.NoTitleBar" >
        </activity>
        <activity
            android:name="com.Help"
            android:label="@string/title_activity_help" >
        </activity>
    </application>

</manifest>
set android:installLocation="internalOnly"

这会将应用程序安装在内部存储中,如果内部存储器中没有空间,则根本不会安装该应用程序

http://developer.android.com/guide/topics/manifest/manifest-element.html

You can do this: 你可以这样做:

FileOutputStream fos;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
    fos = mContext.openFileOutput("New.apk",mContext.MODE_PRIVATE);
} else {
    fos = mContext.openFileOutput("New.apk",Context.MODE_WORLD_READABLE | Context.MODE_WORLD_WRITEABLE);
}

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

相关问题 如何从URL下载内部存储中的apk然后在android中自动安装? - How to download apk in internal storage from URL then install automatically in android? Android如何安装存储在内部存储中的apk - Android how to install apk stored in internal storage 如何将Android App安装到内部sdcard或如何利用内部存储 - How to install Android App to internal sdcard or how to utilize the internal storage 如何从内部存储文件安装应用程序 - how to install an app from internal storage files 如何在Android手机内部存储上写入.apk文件,以便我可以通过编程方式从内部空间安装该应用 - How to write .apk file on android phone internal storage, so that I can install that app from internal space programatically 如何从 android 的内部存储器中移动文件 a? - How to move file a from internal storage of android? 位图未保存到内部存储 (Android) - Bitmaps Not Being Saved to Internal Storage (Android) Android - 如何从内部存储中获取所有文件路径或从内部存储中删除所有文件 - Android - How to get all file path from internal storage or delete all files from internal storage 从Webview上传图像时如何访问内部存储? - How to access internal storage while uploading image from webview? 如何使用Android内部存储? - How to use Android Internal Storage?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM