Use the I2P Android client library
The build script looks for the client library in Maven Central. It is possible
to use a local .aar by placing it in a folder "aars" in the base folder, and
uncommenting the flatDir{} section in the base build.gradle.
This commit is contained in:
@@ -24,6 +24,7 @@ android {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile 'net.i2p.android:client:0.1@aar'
|
||||
compile project(':botejars')
|
||||
compile fileTree(dir: 'libs', include: '*.jar')
|
||||
compile 'com.android.support:support-v4:19.1.0'
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
package net.i2p.android.router.service;
|
||||
|
||||
import net.i2p.android.router.service.IRouterStateCallback;
|
||||
|
||||
/**
|
||||
* An interface for determining the state of the I2P RouterService.
|
||||
*/
|
||||
interface IRouterState {
|
||||
|
||||
/**
|
||||
* This allows I2P to inform on state changes.
|
||||
*/
|
||||
void registerCallback(IRouterStateCallback cb);
|
||||
|
||||
/**
|
||||
* Remove registered callback interface.
|
||||
*/
|
||||
void unregisterCallback(IRouterStateCallback cb);
|
||||
|
||||
/**
|
||||
* Determines whether the RouterService has been started. If it hasn't, no
|
||||
* state changes will ever occur from this RouterService instance, and the
|
||||
* client should unbind and inform the user that the I2P router is not
|
||||
* running (and optionally send a net.i2p.android.router.START_I2P Intent).
|
||||
*/
|
||||
boolean isStarted();
|
||||
|
||||
/**
|
||||
* Get the state of the I2P router
|
||||
**/
|
||||
String getState();
|
||||
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
package net.i2p.android.router.service;
|
||||
|
||||
/**
|
||||
* Callback interface used to send synchronous notifications of the current
|
||||
* RouterService state back to registered clients. Note that this is a
|
||||
* one-way interface so the server does not block waiting for the client.
|
||||
*/
|
||||
oneway interface IRouterStateCallback {
|
||||
/**
|
||||
* Called when the state of the I2P router changes
|
||||
*/
|
||||
void stateChanged(String newState);
|
||||
}
|
||||
@@ -8,6 +8,7 @@ import javax.mail.MessagingException;
|
||||
|
||||
import net.i2p.android.router.service.IRouterState;
|
||||
import net.i2p.android.router.service.IRouterStateCallback;
|
||||
import net.i2p.android.router.service.State;
|
||||
import net.i2p.router.Router;
|
||||
import net.i2p.router.RouterContext;
|
||||
import net.i2p.router.RouterLaunch;
|
||||
@@ -146,8 +147,8 @@ public class BoteService extends Service implements NetworkStatusListener, NewEm
|
||||
mStateService = IRouterState.Stub.asInterface(service);
|
||||
try {
|
||||
mStateService.registerCallback(mStatusListener);
|
||||
String state = mStateService.getState();
|
||||
if ("ACTIVE".equals(state))
|
||||
final int state = mStateService.getState();
|
||||
if (state == State.ACTIVE)
|
||||
I2PBote.getInstance().connectNow();
|
||||
} catch (RemoteException e) {
|
||||
// TODO Auto-generated catch block
|
||||
@@ -164,11 +165,11 @@ public class BoteService extends Service implements NetworkStatusListener, NewEm
|
||||
|
||||
private final IRouterStateCallback.Stub mStatusListener =
|
||||
new IRouterStateCallback.Stub() {
|
||||
public void stateChanged(String newState) throws RemoteException {
|
||||
if ("STOPPING".equals(newState) ||
|
||||
"MANUAL_STOPPING".equals(newState) ||
|
||||
"MANUAL_QUITTING".equals(newState) ||
|
||||
"NETWORK_STOPPING".equals(newState))
|
||||
public void stateChanged(int newState) throws RemoteException {
|
||||
if (newState == State.STOPPING ||
|
||||
newState == State.MANUAL_STOPPING ||
|
||||
newState == State.MANUAL_QUITTING ||
|
||||
newState == State.NETWORK_STOPPING)
|
||||
stopSelf();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -8,10 +8,7 @@ task buildJars(type: Exec) {
|
||||
// TODO an empty botejars.jar is added to the classpath
|
||||
|
||||
artifacts {
|
||||
'default' file: file('libs/i2p.jar'), builtBy: buildJars
|
||||
'default' file: file('libs/router.jar'), builtBy: buildJars
|
||||
'default' file: file('libs/mstreaming.jar'), builtBy: buildJars
|
||||
'default' file: file('libs/streaming.jar'), builtBy: buildJars
|
||||
'default' file: file('libs/bcprov-ecc-jdk16-146.jar'), builtBy: buildJars
|
||||
'default' file: file('libs/flexi-gmss-1.7p1.jar'), builtBy: buildJars
|
||||
'default' file: file('libs/lzma-9.20.jar'), builtBy: buildJars
|
||||
|
||||
@@ -69,21 +69,9 @@
|
||||
</target>
|
||||
|
||||
<target name="copyrouterlibs" depends="buildJarsForBote" >
|
||||
<!-- core -->
|
||||
<!-- remove classes that are overridden -->
|
||||
<!-- lots of unneeded stuff could be deleted here -->
|
||||
<jar destfile="${jar.libs.dir}/i2p.jar" >
|
||||
<zipfileset src="${i2plib}/i2p.jar" >
|
||||
<exclude name="net/i2p/util/LogWriter.class" />
|
||||
</zipfileset>
|
||||
</jar>
|
||||
|
||||
<!-- router -->
|
||||
<copy file="${i2plib}/router.jar" todir="${jar.libs.dir}" />
|
||||
|
||||
<!-- streaming -->
|
||||
<copy file="${i2plib}/mstreaming.jar" todir="${jar.libs.dir}" />
|
||||
<copy file="${i2plib}/streaming.jar" todir="${jar.libs.dir}" />
|
||||
<!-- Other libs included in client library -->
|
||||
</target>
|
||||
|
||||
<available property="have.bote" file="${botelib}/i2pbote.jar" />
|
||||
|
||||
@@ -10,6 +10,9 @@ buildscript {
|
||||
|
||||
allprojects {
|
||||
repositories {
|
||||
// flatDir {
|
||||
// dirs file("${project.rootDir}/aars")
|
||||
// }
|
||||
mavenCentral()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user