How I can install apk automatically when the sdcard put on?
I have not any idea. How can I install apk automatically when the sdcard put on?
However, I have got an problem, When I register the receiver that listened to the ACTION_MEDIA_SHARED in AndroidManifest.xml
Em... i create a Receiver that extends BroadcastReceive, i override OnReceive().
But, finally, the Receiver can not get any Action. Here is my code. Frustrating!!!!!
<receiver android:name=".SdcardPutOnListener"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.ACTION_MEDIA_BAD_REMOVAL" />
<action android:name="android.intent.action.ACTION_MEDIA_MEDIA_CHECKING" />
<action android:name="android.intent.action.ACTION_MEDIA_EJECT" />
<action android:name="android.intent.action.ACTION_MEDIA_MOUNTED" />
<action android:name="android.intent.action.ACTION_MEDIA_NOFS" />
<action android:name="android.intent.action.ACTION_MEDIA_REMOVED" />
<action android:name="android.intent.action.ACTION_MEDIA_SHARED" />
<action android:name="android.intent.action.ACTION_MEDIA_UNMOUNTABLE" />
<data android:scheme="file" />
<category android:name="android.intent.category.HOME"/>
</intent-filter>
</receiver>
public class SdcardPutOnListener extends BroadcastReceiver {
final static String TAG = "SdcardPutOnListener";
public void onReceive(Context context, Intent intent) {
Log.i(TAG, "receive broadcast " + intent.getAction());
}
}
You could create an app that watches for the ACTION_MEDIA_MOUNTED
broadcast, then looks at external storage in a well-known spot for an APK file, then calls startActivity()
with an ACTION_VIEW
Intent
on the path to that APK file, with the right MIME type ( application/vnd.android.package-archive
).
If you are expecting this to be built into the operating system, it is not.
链接地址: http://www.djcxy.com/p/61190.html上一篇: 使用不同网址的Web应用程序的响应时间
下一篇: 如何在安装SD卡时自动安装apk?