diff --git a/plugin.xml b/plugin.xml index ce63199..ef648e7 100644 --- a/plugin.xml +++ b/plugin.xml @@ -28,7 +28,11 @@ - + @@ -36,7 +40,7 @@ + - diff --git a/src/android/ApkInstaller.java b/src/android/ApkInstaller.java index 56c8b1d..6078d7d 100644 --- a/src/android/ApkInstaller.java +++ b/src/android/ApkInstaller.java @@ -10,6 +10,7 @@ import android.content.Context; import android.support.v4.content.FileProvider; import java.text.SimpleDateFormat; +import android.util.Log; public class ApkInstaller extends CordovaPlugin { @@ -20,11 +21,14 @@ public class ApkInstaller extends CordovaPlugin { @Override public boolean execute(String action, JSONArray data, CallbackContext callbackContext) throws JSONException { if (action.equals(ACTION_INSTALL)) { - String fileName = data.getString(0); - Context context = this.cordova.getActivity().getApplicationContext(); - File file = new File(context.getFilesDir() + "/" + fileName); - try { + String fileName = data.getString(0); + Context context = this.cordova.getActivity().getApplicationContext(); + String filepath = context.getFilesDir() + "/" + fileName; + Log.d("apkInstaller", filepath); + File file = new File(context.getFilesDir() + "/" + fileName); + + // Get file uri Uri uri = FileProvider.getUriForFile(context, context.getPackageName() + ".fileprovider", file); Intent intent = new Intent(Intent.ACTION_VIEW); diff --git a/src/android/ApkInstallerProvider.java b/src/android/ApkInstallerProvider.java new file mode 100644 index 0000000..8f1d9c9 --- /dev/null +++ b/src/android/ApkInstallerProvider.java @@ -0,0 +1,7 @@ +package plugin.apkInstaller; + +import android.support.v4.content.FileProvider; + +public class ApkInstallerProvider extends FileProvider { + // avoid android:authrities conflict with other lib which also use android.support.v4.content.FileProvider +} diff --git a/src/android/libs/android-support-v4.jar b/src/android/libs/android-support-v4.jar deleted file mode 100644 index 2ff47f4..0000000 Binary files a/src/android/libs/android-support-v4.jar and /dev/null differ