Install APK programmatically on android

前端 未结 1 807
暖寄归人
暖寄归人 2020-12-14 04:47

I\'ve been trying to get an android application to install an APK on the sdcard programmatically but I\'m running into a little trouble.

This is how I\'m doing it:

1条回答
  •  臣服心动
    2020-12-14 05:19

    You can add a receiver to your AndroidManifest.xml to listen to broadcasts if a new app is installed. Like this:

    
        
            
            
            
            
        
    
    

    This class then gets called when a new package is installed:

    public class PackageReceiver extends BroadcastReceiver {
    
      @Override
      public void onReceive(Context context, Intent intent) {
        // handle install event here
      }
    }
    

    0 讨论(0)
提交回复
热议问题