Downloading an .apk update

by dashman » Thu, 10 Feb 2011 23:40:03 GMT


Sponsored Links
 i'd like to allow users to download any updates directly
from my app (hosted on own server).

right now i do this:

the url contains a link to the http: link to the .apk file:

                Intent i = new Intent(Intent.ACTION_VIEW);
                i.setData(Uri.parse(url));

                startActivity(i);

minor problem is that the webviewer pops up briefly
and then the downloading starts.

visually not very nice.

is there a better way of doing this - w/o the webviewer
popping up.

-- 



Re: Downloading an .apk update

by Marcin Orlowski » Fri, 11 Feb 2011 00:00:00 GMT


 > is there a better way of doing this - w/o the webviewer

You can download APK (i.e. to SD card) yourself w/o need of WebView
and the just init install of downloaded package

-- 


Sponsored Links


Re: Downloading an .apk update

by Mark Murphy » Fri, 11 Feb 2011 00:23:16 GMT


 Don't forget to include the MIME type in the Intent, though.

On Thu, Feb 10, 2011 at 10:59 AM, Marcin Orlowski





-- 
Mark Murphy (a Commons Guy)
 http://commonsware.com  |  http://github.com/commonsguy 
 http://commonsware.com/blog  |  http://twitter.com/commonsguy 

_The Busy Coder's Guide to Android Development_ Version 3.4 Available!

-- 



Re: Downloading an .apk update

by dashman » Fri, 11 Feb 2011 01:11:08 GMT


 i set the mime-type like this

i.setType("application/vnd.android.package-archive");

and the app crashes.

if i comment out the line - no crash and the webview
opens and the .apk file is downloaded.

again the url points to a .apk file.

-- 



Re: Re: Downloading an .apk update

by Mark Murphy » Fri, 11 Feb 2011 01:44:32 GMT


 


Use setDataAndType(). setType() nulls out your Uri. And, again, this
is only needed if you follow Marcin's recommendation and download the
APK yourself, then use an Intent to kick off installation.

-- 
Mark Murphy (a Commons Guy)
 http://commonsware.com  |  http://github.com/commonsguy 
 http://commonsware.com/blog  |  http://twitter.com/commonsguy 

_The Busy Coder's Guide to Android Development_ Version 3.4 Available!

-- 



Re: Downloading an .apk update

by dashman » Fri, 11 Feb 2011 05:11:10 GMT


 ok - i see what marcin was suggesting.

i download the .apk to the sd card.

now - what intent do i start to install the .apk file.








-- 



Re: Re: Downloading an .apk update

by Kostya Vasilyev » Fri, 11 Feb 2011 05:20:29 GMT


 Something like this should work:

Intent intent = new Intent(android.content.Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(file),"application/vnd.android.package-archive"); 


startActivity(intent);

-- Kostya

11.02.2011 0:11, dashman :
ok - i see what marcin was suggesting. i download the .apk to the sd card. now - what intent do i start to install the .apk file.
i set the mime-type like this i.setType("application/vnd.android.package-archive"); and the app crashes.
Use setDataAndType(). setType() nulls out your Uri. And, again, this is only needed if you follow Marcin's recommendation and download the APK yourself, then use an Intent to kick off installation. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguyhttp ://commonsware.com/blog| http://twitter.com/commonsguy _The Busy Coder's Guide to Android Development_ Version 3.4 Available!
-- Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com --



Re: Re: Downloading an .apk update

by Mark Murphy » Fri, 11 Feb 2011 05:28:39 GMT


 ACTION_VIEW, IIRC. Just specify a path to the downloaded file for the
Uri to setDataAndType().









-- 
Mark Murphy (a Commons Guy)
 http://commonsware.com  |  http://github.com/commonsguy 
 http://commonsware.com/blog  |  http://twitter.com/commonsguy 

Android App Developer Books:  http://commonsware.com/books 

-- 



Re: Downloading an .apk update

by Traveler » Fri, 11 Feb 2011 22:49:36 GMT


 The following url explains how to install an .apk file from your SD
card. My daughter helps me test my projects, so she installs the .apk
to her Droid after I send it to her as an e-mail attachment.

 http://www.ieumart.com/how-to-install-apk-files-through-desktop-using-windows-vista.html 








-- 



Re: Re: Downloading an .apk update

by Marcin Orlowski » Fri, 11 Feb 2011 23:08:34 GMT


 


The link you gave is irrelevant to the former subject. We talk
here about installing APK from own code, w/o need of any
external tools like adb nor desktop box.

-- 



Other Threads

1. Real estate application and Joomla

Is there any real estate applications for Android?

--

2. The Google Phone is real (confirmed by Google)

This post doesn't have a lot of details, but it does confirm that
Google is creating their own hardware.  There has been a ton of
speculation about this, so this confirmation is really interesting.
It does look like it won't be available to the public (they describe
it as a mobile lab), but just for Googlers.

http://googlemobile.blogspot.com/2009/12/android-dogfood-diet-for-holidays.html

--

3. Cell Broadcast service in android

4. iPhone Application Development

5. Hiding Controls on VideoView using MediaController

6. tv output??

7. Intent return string - split into variables ?