install / uninstall APKs programmatically (by PackageManager)

Discussion in 'Android Questions' started by peacemaker, Jul 4, 2012.

  1. peacemaker

    peacemaker Well-Known Member Licensed User

  2. NJDude

    NJDude Expert Licensed User

    You can try this to Install:
    Code:
    Dim i As Intent 

    i.Initialize(i.ACTION_VIEW, 
    "file:///sdcard/MyAPK.apk")
    i.SetType(
    "application/vnd.android.package-archive")

    StartActivity(i)
    To Uninstall:
    Code:
    Dim i As Intent

    i.Initialize(
    "android.intent.action.DELETE""package:com.example.app")

    StartActivity(i)
    Is that what you want to do?
     
    Last edited: Jul 4, 2012
  3. peacemaker

    peacemaker Well-Known Member Licensed User

    NJDude, i know about this manual install\uninstall by Intents.
    Question is for background installation\uninstallation APKs by the launcher that is a custom Market.
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    It is not possible to silently install or uninstall an APK unless your application is part of OS ROM.
     
    Peter Simpson likes this.
  5. peacemaker

    peacemaker Well-Known Member Licensed User

    Yes, this application is planned to be main ROM launcher.
    Must it be in system app folder evn for debugging ?
     
    Last edited: Jul 5, 2012
  6. Erel

    Erel Administrator Staff Member Licensed User

    You will need to call private Android APIs to install / uninstall the apps. I'm afraid that I'm not familiar with these APIs nor they are probably not documented anywhere.
     
  7. peacemaker

    peacemaker Well-Known Member Licensed User

    But links in my first post shows

    Seems, there some people posted that used, and there is link to a working Eclipse code.
    Do you mean now these functions cannot be tried anywhow with help of Reflection ?
     
  8. Erel

    Erel Administrator Staff Member Licensed User

    You can try them with reflection.
     
  9. peacemaker

    peacemaker Well-Known Member Licensed User

    Seems, real way is only by Shell commands to install\uninstall hidden.
     
  10. peacemaker

    peacemaker Well-Known Member Licensed User

  11. Erel

    Erel Administrator Staff Member Licensed User

    These objects are not used by Basic4android.
     
  12. Dogbonesix

    Dogbonesix Active Member Licensed User

    Too manykeys, I guess

    I was getting errors loading my first key and after many tries I believe there are several keys now. In fact I am not really sure how I got this far.

    But my problem now is below:

    Installation will fail if the signing key is different than the previous used key.
    In that case you will need to manually uninstall the existing application.
    Completed successfully.

    I have two questions: 1) How do I manually uninstall the application?

    Or

    As the application is quite small - just recode (cut and paste) a new application with different package and application labels and start a new signing process?
     
  13. Dogbonesix

    Dogbonesix Active Member Licensed User

    See Above Post

    I was looking too deep. Solution :signOops:too simple... Just delete the application on the phone not on B4A...
     
  14. Devv

    Devv Active Member Licensed User

    You only need to have root access , i had tested this on multiple devices , no need for ROM integration so far ...
     
  15. DonManfred

    DonManfred Expert Licensed User

    This is an old thread!!! Why are you ansering on an 2,5 years old thread?
    If you have an issue then you should create a new thread
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice