1

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 talk, video, videotalk, DRM, Market.

What happened? Did the install intents changed in Gingerbread? How to make new install intent at Android Gingerbread? Thanks

Flow
  • 23,572
  • 15
  • 99
  • 156
Waypoint
  • 17,283
  • 39
  • 116
  • 170
  • Try creating the `File` object using the appropriate `File` constructor rather than string concatenation, and see if that helps. – CommonsWare Aug 30 '11 at 09:50
  • Nope, problem is that it looks like Android 2.3 doesn't know the corresponding MIME type... – Waypoint Aug 30 '11 at 10:17
  • [`PackageInstaller` does](http://www.google.com/codesearch#cZwlSNS7aEw/packages/apps/PackageInstaller/AndroidManifest.xml&exact_package=android&q=application/vnd.android.package-archive&type=cs) – CommonsWare Aug 30 '11 at 10:34

1 Answers1

1

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.

Andrey Atapin
  • 7,745
  • 3
  • 28
  • 34
  • Hi, thanks for reply. I am trying it on emulator and on the phone Galaxy S, still having the same issue. I have non-market apps install enabled, really don't know what is the problem – Waypoint Aug 30 '11 at 09:18
  • @Hmyzak, can you try using ACTION_GET_CONTENT instead of current action? (Unfortunately I don't have anything around me to test.) – Andrey Atapin Aug 30 '11 at 09:24
  • I have tried it and it is not the solution, I am getting error of ACTION_GET_CONTENT – Waypoint Aug 30 '11 at 09:28
  • http://stackoverflow.com/questions/4604239/install-application-programmatically-on-android/4605040#4605040 take a look at this discussion too – Andrey Atapin Aug 30 '11 at 09:37
  • THanks for comment, but it didn't helped :-( – Waypoint Aug 30 '11 at 10:04