Install intent for local .apk file on gingerbread
When I installed new APK from another App on Android 2.1, I just used:
Intent intent2 = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(new File(Environment.getExternalStorageDirectory()+"/Download/" + "app.apk")), "application/vnd.android.package-archive");
startActivity(intent2);
It opened new install dialog and i could use it.
Now, I try the same code on Gingerbread 2.3.3, and when I start this install intent, it shows me a selection "select action using application". With the following choices: Google t开发者_Python百科alk, video, videotalk, DRM, Market.
What happened? Did the install intents changed in Gingerbread? How to make new install intent at Android Gingerbread? Thanks
The API reference says that there weren't any changes applied in startActivity(Intent) method. ACTION_VIEW launches the default activity to handle a piece of data or asks to choose one to make default (as I see). If you are getting the list of apps to launch then you don't have default action for this type of data. Also, check if non-market apps are enabled to be installed on your device.
精彩评论