I've put some apk publish tips (including the mime type) at 
http://andappstore.com/AndroidPhoneApplications/publishing.jsp

Al.
--
http://andappstore.com/

nknize wrote:
> Either I'm not stating my question correctly or it just isn't being
> understood.  So I'll keep it specific and to the point.  What is the
> MIME type to "view an .apk" as you have so simply stated?  I have an
> apk that is already downloaded to the sdcard and I'm simply trying to
> launch an intent to view it.
>
> e.g. /sdcard/myapk.apk
>
> If I understand what you are saying, it should be as easy as...
>
>               Intent myIntent = new Intent(
>                              Intent.ACTION_VIEW,
>                              Uri.parse(MIMETag +
> apkFile.getAbsolutePath().toString()));
>               startActivity(myIntent);
>
> So what is that correct MIMETag that will cause the system to find and
> call the appropriate content provider that launches the install UI you
> mentioned (that subsequently "asks the user if it is okay to install
> the app..etc")?
>
> Thx again...
>
> - Nick
>
> On Oct 6, 5:01 pm, hackbod <[EMAIL PROTECTED]> wrote:
>   
>> As I already said, you can not do that.  If an app gets a permission
>> to do that, it effectively gets a permission to do ANYTHING possible.
>> This is not really a path we want to go down.
>>
>> If you want to install an app, you need to start an activity to view
>> the .apk (which you have already downloaded, and supplying the proper
>> MIME type for the data), which will allow the system to bring up its
>> UI to ask the user if it is okay to install the app with the
>> permissions it requires etc.
>>
>> That is the way it works.  Period.
>>
>> On Oct 6, 1:23 pm, nknize <[EMAIL PROTECTED]> wrote:
>>
>>     
>>> That's right...  "You can't directly install an apk without the user
>>> being involved."  This is exactly what I want/am trying to do - let
>>> the user install the apk through a customized application.  Is there
>>> an "out of the box" intent or activity that can be integrated with
>>> one's application that allows the user to install the apk?  Because
>>> right now.. any attempt to install an apk programmatically inevitably
>>> throws a permissions exception.  I'm still unclear what is meant by
>>> "launch an intent to view it."
>>>       
>>> - Nick
>>>       
>>> On Oct 6, 9:50 am, Al Sutton <[EMAIL PROTECTED]> wrote:
>>>       
>>>> Are you sure that INSTALL_PACKAGES will be a user grantable permission?,
>>>> I can see an argument for INSTALL_PACKAGES having uses, but I can also
>>>> see the ability for it to be abused to install Spyware/Adware which the
>>>> user did not want.
>>>>         
>>>> Al.
>>>> --http://andappstore.com/
>>>>         
>>>> nknize wrote:
>>>>         
>>>>> Adding android.permission.INSTALL_PACKAGES to the manifest results in
>>>>> the following:
>>>>>           
>>>>> 10-05 18:50:45.631: WARN/PackageManager(57): Not granting permission
>>>>> android.permission.INSTALL_PACKAGES to package com.test
>>>>> (protectionLevel=2 flags=0x44)
>>>>>           
>>>>> Subsequently tried the following without any luck...
>>>>>           
>>>>> try {
>>>>>    Intent myIntent = new Intent(
>>>>>                Intent.ACTION_PACKAGE_INSTALL,
>>>>>                Uri.parse("file://" +
>>>>> apkFile.getAbsolutePath().toString());
>>>>>    startActivity(myIntent);
>>>>> } catch (Exception e) {
>>>>>    Log.e(tag, e.getMessage();
>>>>> }
>>>>>           
>>>>> Results in the following:
>>>>>           
>>>>> 10-05 18:50:49.440: ERROR/APKInstaller(316): No Activity found to
>>>>> handle Intent { action=android.intent.action.PACKAGE_INSTALL
>>>>> data=file:///c:/test.apk }
>>>>>           
>>>>> I'm assuming thePackageManagerand/or IPackageInstallObserver must
>>>>> play a role somewhere in this process.
>>>>>           
>>>>> What exactly do you mean by "launch an intent to view it?"
>>>>>           
>>>>> Thx to anyone that can help clear this up.
>>>>>           
>>>>> - Nick
>>>>>           
>>>>> On Aug 26, 4:27 am, hackbod <[EMAIL PROTECTED]> wrote:
>>>>>           
>>>>>> You can download an apk and launch an intent to view it, allowing the
>>>>>> user to install it, like the browser does.  You can't directly install
>>>>>> an apk without the user being involved (and thus approving the
>>>>>> action).
>>>>>>             
>>>>>> On Aug 26, 1:26 am, Wesley <[EMAIL PROTECTED]> wrote:
>>>>>>             
>>>>>>> hi,
>>>>>>>               
>>>>>>> oic
>>>>>>>               
>>>>>>> so this is means we cannot download the apk and install it or somehow 
>>>>>>> delete
>>>>>>> the package using our application???
>>>>>>>               
>>>>>>> :)
>>>>>>>               
>>>>>>> Wesley.
>>>>>>>               
>>>>>>> On Tue, Aug 26, 2008 at 3:36 PM, hackbod <[EMAIL PROTECTED]> wrote:
>>>>>>>               
>>>>>>>> This is not available to applications, sorry.
>>>>>>>>                 
>>>>>>>> On Aug 26, 12:25 am, Wesley Sagittarius <[EMAIL PROTECTED]> wrote:
>>>>>>>>                 
>>>>>>>>> hi,
>>>>>>>>>                   
>>>>>>>>> Does anyone successful use thePackageManager to install apk???
>>>>>>>>>                   
>>>>>>>>> wesley.
>>>>>>>>>                   
>>>> --
>>>> Al Sutton
>>>>         
>>>> W:www.alsutton.com
>>>> B: alsutton.wordpress.com
>>>> T: twitter.com/alsutton
>>>>         
> >
>   


-- 
Al Sutton

W: www.alsutton.com
B: alsutton.wordpress.com
T: twitter.com/alsutton


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to