[android-developers] Installing apk package from my application

2011-05-31 Thread maha rm
Hi,

 I'm trying to write an application which will install the apk from a
specified location. The code I've added is

public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

File apkFile = new File(/data/install_flashplayer.apk);
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(apkFile),
application/vnd.android.package-archive);
int reqCode = 0;
startActivityForResult(intent,reqCode);
Log.v(REsult,reqCode = +reqCode);

}

This is installing the install_flashplayer.apk from the location /data.
The problem i'm facing is that after the package is installed, it shows a
messagebox with the button Done. I'm expecting the behaviour of pressing
Done button should close the application itself rather than only closing the
messagebox. Right now, It closes the message box and package installer and
shows my application.

Can anyone help me how to get notified that Done button is pressed and
how to close the application once it is clicked?

Thanks,
Maha

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Installing apk package from my application

2011-05-31 Thread TreKing
On Tue, May 31, 2011 at 4:30 AM, maha rm maha2...@gmail.com wrote:

 Can anyone help me how to get notified that Done button is pressed and
 how to close the application once it is clicked?


You probably can't get notified of that button click, but there is a
broadcast when a package is installed ...

-
TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago
transit tracking app for Android-powered devices

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Installing apk package from my application

2011-05-31 Thread Dianne Hackborn
Note that installing from the SD card is fundamentally dangerous because
another app can replace that file with their own and cause the user to
install something different than you intend.

On Tue, May 31, 2011 at 2:30 AM, maha rm maha2...@gmail.com wrote:

 Hi,

  I'm trying to write an application which will install the apk from a
 specified location. The code I've added is

 public void onCreate(Bundle savedInstanceState) {
 super.onCreate(savedInstanceState);

 File apkFile = new File(/data/install_flashplayer.apk);
 Intent intent = new Intent(Intent.ACTION_VIEW);
 intent.setDataAndType(Uri.fromFile(apkFile),
 application/vnd.android.package-archive);
 int reqCode = 0;
 startActivityForResult(intent,reqCode);
 Log.v(REsult,reqCode = +reqCode);

 }

 This is installing the install_flashplayer.apk from the location /data.
 The problem i'm facing is that after the package is installed, it shows a
 messagebox with the button Done. I'm expecting the behaviour of pressing
 Done button should close the application itself rather than only closing the
 messagebox. Right now, It closes the message box and package installer and
 shows my application.

 Can anyone help me how to get notified that Done button is pressed
 and how to close the application once it is clicked?

 Thanks,
 Maha

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en




-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en