[英]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.