Allow third-party apps to start I2P on Android via a Bradcast Intent #18

Closed
opened 2025-04-21 14:44:39 -04:00 by idk · 3 comments
Owner

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?

Subtickets

Opened [17 months ago](/timeline?from=2019-12-20T22%3A17%3A35Z&precision=second "See timeline at Dec 20, 2019 10:17:35 PM") Last modified [16 months ago](/timeline?from=2019-12-28T15%3A52%3A39Z&precision=second "See timeline at Dec 28, 2019 3:52:39 PM") ## [\#2677](/ticket/2677)[open](/query?status=open)[enhancement](/query?status=!closed&type=enhancement) # Allow third-party apps to start I2P on Android via a Bradcast Intent Reported by:[Soren Stoutner](/query?status=!closed&reporter=sorenstoutner)Owned by:[Meeh](/query?status=!closed&owner=meeh) Priority: [minor](/query?status=!closed&priority=minor) Milestone: [undecided](/milestone/undecided "No date set") Component: [apps/android](/query?status=!closed&component=apps%2Fandroid) Version: [0.9.44](/query?status=!closed&version=0.9.44) Keywords: [broadcast](/query?status=!closed&keywords=~broadcast) [intent](/query?status=!closed&keywords=~intent) Cc: Parent Tickets: Sensitive: [no](/query?status=!closed&sensitive=0) ### Description I am the developer of Privacy Browser. [​https://www.stoutner.com/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](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? ### Subtickets
idk added this to the 0.9.51 milestone 2025-04-21 14:44:39 -04:00
idk added the #2677apps.androidundecided labels 2025-04-21 14:44:39 -04:00
idk self-assigned this 2025-04-21 14:44:39 -04:00
idk closed this issue 2025-04-21 14:44:39 -04:00
Author
Owner

related discussion thread: http://zzz.i2p/topics/3174

related discussion thread: http://zzz.i2p/topics/3174
Author
Owner

comment:2 Changed 16 months ago by Meeh

It's ok with me but I don't know how to implement that on our side.

[comment:2](https://trac.i2p2.de/\#comment:2) Changed [16 months ago](https://trac.i2p2.de//timeline?from=2019-12-28T15%3A52%3A39Z&precision=second "See timeline at Dec 28, 2019 3:52:39 PM") by Meeh It's ok with me but I don't know how to implement that on our side.
Author
Owner

comment:1 Changed 16 months ago by zzz

Status:new →
open

Fine with me, let's see what Meeh says. You willing to give us a patch for it?

[comment:1](https://trac.i2p2.de/\#comment:1) Changed [16 months ago](https://trac.i2p2.de//timeline?from=2019-12-22T10%3A08%3A29Z&precision=second "See timeline at Dec 22, 2019 10:08:29 AM") by zzz Status:new → open Fine with me, let's see what Meeh says. You willing to give us a patch for it?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: I2P_Developers/i2p.android.base#18
No description provided.