Hello, I'm new to Android development and don't realy know about how to use all the given functions.
What I want to do is to build a tool (only a proof of concept) to manage installation of new packages. The thing is I can't figure out how to install a new package. First I added a uses-permission tag with the value "android.permission.INSTALL_PACKAGES" into my packages manifest file. I've found the function "installPackage(Uri uri)" inside the PackageManager class. So I tried to use it this way: Uri.Builder uribuilder = new Uri.Builder(); uribuilder.scheme("http"); uribuilder.path("//hostname/SamplePackage.apk"); PackageManager pm = getPackageManager(); pm.installPackage(uribuilder.build()); What happens is that my application crashes. Using the debuger I figured out that a NullPointerException occurs inside the PackageManager class. The next way I tried to install a package is using the already existing "Package Manager". So I created a new Intent to call the Package Manager and called StartActivity with this Intent: Uri.Builder uribuilder = new Uri.Builder(); uribuilder.scheme("http"); uribuilder.path("//hostname/SamplePackage.apk"); Intent intent = new Intent(Intent.ACTION_PACKAGE_INSTALL, uribuilder.build()); startActivity(intent); But also this method ends with a NullPointerException. What am I doing wrong? How can I get this job done? I don't have a real phone to develop on, only the Android emulator. Maybe the emulator doesn't support this function or this Intent!? Thanks for help Lutz
smime.p7s
Description: S/MIME cryptographic signature