diff --git a/app/src/main/java/com/emanuelef/remote_capture/MitmAddon.java b/app/src/main/java/com/emanuelef/remote_capture/MitmAddon.java
index e4313fb3..5c882753 100644
--- a/app/src/main/java/com/emanuelef/remote_capture/MitmAddon.java
+++ b/app/src/main/java/com/emanuelef/remote_capture/MitmAddon.java
@@ -48,8 +48,8 @@ import java.io.IOException;
import java.lang.ref.WeakReference;
public class MitmAddon {
- public static final long PACKAGE_VERSION_CODE = 13;
- public static final String PACKAGE_VERSION_NAME = "v0.13";
+ public static final long PACKAGE_VERSION_CODE = 14;
+ public static final String PACKAGE_VERSION_NAME = "v0.14";
public static final String REPOSITORY = "https://github.com/emanuele-f/PCAPdroid-mitm";
private static final String TAG = "MitmAddon";
private final Context mContext;
diff --git a/app/src/main/java/com/emanuelef/remote_capture/fragments/mitmwizard/InstallCertificate.java b/app/src/main/java/com/emanuelef/remote_capture/fragments/mitmwizard/InstallCertificate.java
index b032034a..c6057dc9 100644
--- a/app/src/main/java/com/emanuelef/remote_capture/fragments/mitmwizard/InstallCertificate.java
+++ b/app/src/main/java/com/emanuelef/remote_capture/fragments/mitmwizard/InstallCertificate.java
@@ -42,6 +42,7 @@ import com.emanuelef.remote_capture.R;
import com.emanuelef.remote_capture.Utils;
import com.emanuelef.remote_capture.interfaces.MitmListener;
import com.emanuelef.remote_capture.MitmAddon;
+import com.pcapdroid.mitm.MitmAPI;
import java.io.IOException;
import java.io.PrintWriter;
@@ -76,12 +77,7 @@ public class InstallCertificate extends StepFragment implements MitmListener {
gotoStep(R.id.navto_done);
})
.show());
-
mAddon = new MitmAddon(requireContext(), this);
- if(!mAddon.connect(0)) {
- Toast.makeText(requireContext(), "addon connect failed", Toast.LENGTH_LONG).show();
- certFail();
- }
}
@Override
@@ -92,7 +88,29 @@ public class InstallCertificate extends StepFragment implements MitmListener {
@Override
public void onResume() {
- if(Utils.isCAInstalled(mCaCert))
+ if(!Utils.isCAInstalled(mCaCert)) {
+ if(!mAddon.isConnected()) {
+ if (!mAddon.connect(0)) {
+ new AlertDialog.Builder(requireContext())
+ .setTitle(R.string.error)
+ .setMessage(R.string.mitm_addon_autostart_workaround)
+ .setNegativeButton(R.string.no, (dialogInterface, i) -> {
+ Toast.makeText(requireContext(), "addon connect failed", Toast.LENGTH_LONG).show();
+ certFail();
+ })
+ .setPositiveButton(R.string.yes, (d, whichButton) -> {
+ Context ctx = requireContext();
+ Intent launchIntent = ctx.getPackageManager().getLaunchIntentForPackage(MitmAPI.PACKAGE_NAME);
+ if (launchIntent != null)
+ Utils.startActivity(ctx, launchIntent);
+ else {
+ Toast.makeText(requireContext(), "addon connect failed", Toast.LENGTH_LONG).show();
+ certFail();
+ }
+ }).show();
+ }
+ }
+ } else
certOk();
super.onResume();
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 4e976a7c..65f49b8c 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -269,7 +269,7 @@
TLS decryption is starting…
TLS decryption is running
Traffic inspection
- Could not start the mitm service. Reinstall the mitm addon and retry
+ Could not start the mitm service. Try to open the mitm addon app manually and retry
Mitm setup wizard
Install
Export
@@ -460,4 +460,5 @@
Write to external storage failed. Check the app log for details
Username
Password
+ Connection to the mitm addon failed. As a workaround, you can try to open the mitm addon app and then go back to PCAPdroid without closing it. Do you want to open it now?