Allow third-party apps to start I2P on Android via a Bradcast Intent
Opened 17 months ago
Last modified 16 months ago
#2677openenhancement
Allow third-party apps to start I2P on Android via a Bradcast Intent
Reported by:Soren StoutnerOwned by:Meeh Priority: minor Milestone: undecided Component: apps/android Version: 0.9.44 Keywords: broadcast intent Cc:
Parent Tickets:
Sensitive: no
Description
I am the developer of Privacy Browser. https://www.stoutner.com/privacy-browser/. The upcoming 3.3 release will include an option to proxy through I2P.
I looked over the integration options in https://github.com/i2p/i2p.android.base/blob/master/lib/helper/src/main/java/net/i2p/android/ui/I2PAndroidHelper.java. I noticed that if a third party app wants to start I2P it needs to use startActivity()
or startActivityForResult()
. Specifically,
Intent i = new Intent("net.i2p.android.router.START_I2P");
activity.startActivityForResult(i, REQUEST_START_I2P);
This isn't as slick as the the options I have with Orbot, where I can use a broadcast intent.
Create an intent to request Orbot to start.
Intent orbotIntent = new Intent("org.torproject.android.intent.action.START");
Send the intent to the Orbot package.
orbotIntent.setPackage("org.torproject.android");
Request a status response be sent back to this package.
orbotIntent.putExtra("org.torproject.android.intent.extra.PACKAGE_NAME", context.getPackageName());
Make it so.
context.sendBroadcast(orbotIntent);
The beauty of this approach is that it let's my app start Orbot in the background, without making the user leave the app.
I am not aware of any possible negative consequences to using a broadcast intent. Would you be amenable to adding an option for one to I2P?