Programatically install apk from assets folder in android

前端 未结 2 652
我在风中等你
我在风中等你 2020-12-08 18:01

I am trying to install apk programatically from assets folder but not success, Please help me. I am using following code for that. thank you.

Intent intent =         


        
2条回答
  •  悲哀的现实
    2020-12-08 18:24

    Copy the apk file into assets folder.

    try this method it worked for me ..........

    private void launchComponent(String packageName, String name) { 
    
      // Name should be starting activity complete name with package name
            Intent launch_intent = new Intent("android.intent.action.MAIN");
            launch_intent.addCategory("android.intent.category.LAUNCHER");
            launch_intent.setComponent(new ComponentName(packageName, name));
            launch_intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    
            this.startActivity(launch_intent);
        }
    

提交回复
热议问题