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:
You can add a receiver to your AndroidManifest.xml
to listen to broadcasts if a new app is installed.
Like this:
<receiver android:name=".PackageReceiver">
<intent-filter>
<action android:name="android.intent.action.PACKAGE_ADDED" />
<action android:name="android.intent.action.PACKAGE_CHANGED" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="package" />
</intent-filter>
</receiver>
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
}
}