Compare commits
11 Commits
android-0.
...
android-0.
Author | SHA1 | Date | |
---|---|---|---|
aec25ab374 | |||
9d5c495936 | |||
4dc2bb6b01 | |||
373e013911 | |||
83bb7096a7 | |||
cc1c4690a2 | |||
69ad581235 | |||
4be227631d | |||
3f3f1f8e3d | |||
22290da1a4 | |||
a523e1cb4a |
@ -1,3 +1,12 @@
|
||||
0.9.47 2020-8-26
|
||||
* Notification bug-fixes on platforms >8.0
|
||||
|
||||
0.9.46 2020-6-03
|
||||
* catch ActivityNotFound exception in MainActivity
|
||||
|
||||
0.9.45
|
||||
* No significant changes
|
||||
|
||||
0.9.44 / 2019-12-03
|
||||
* Updated translations
|
||||
* Bumped target sdk version to 28, enforced by google
|
||||
|
@ -7,7 +7,7 @@ repositories {
|
||||
android {
|
||||
compileSdkVersion 28
|
||||
defaultConfig {
|
||||
versionCode 4745255
|
||||
versionCode 4745257
|
||||
versionName "$I2P_VERSION"
|
||||
minSdkVersion 14
|
||||
targetSdkVersion Integer.parseInt(project.ANDROID_BUILD_TARGET_SDK_VERSION as String)
|
||||
|
@ -16,6 +16,7 @@ import android.preference.PreferenceManager;
|
||||
import android.provider.Settings;
|
||||
import android.support.v4.content.LocalBroadcastManager;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.util.AndroidRuntimeException;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
@ -27,6 +28,7 @@ import android.widget.ScrollView;
|
||||
import android.widget.TableLayout;
|
||||
import android.widget.TableRow;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
import android.widget.ToggleButton;
|
||||
|
||||
import net.i2p.android.I2PActivityBase;
|
||||
@ -646,10 +648,10 @@ public class MainFragment extends I2PFragmentBase {
|
||||
PowerManager pm = (PowerManager) mContext.getSystemService(Context.POWER_SERVICE);
|
||||
if (!pm.isIgnoringBatteryOptimizations(packageName)) {
|
||||
AlertDialog.Builder b = new AlertDialog.Builder(getActivity());
|
||||
b.setTitle(R.string.configure_no_doze_title)
|
||||
.setMessage(R.string.configure_no_doze)
|
||||
.setCancelable(false)
|
||||
.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
|
||||
b.setTitle(R.string.configure_no_doze_title);
|
||||
b.setMessage(R.string.configure_no_doze);
|
||||
b.setCancelable(false);
|
||||
b.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int i) {
|
||||
String packageName = mContext.getPackageName();
|
||||
@ -661,17 +663,19 @@ public class MainFragment extends I2PFragmentBase {
|
||||
mContext.startActivity(intent);
|
||||
} catch (ActivityNotFoundException activityNotFound) {
|
||||
ab.setPref(PREF_CONFIGURE_BATTERY, true);
|
||||
} catch (AndroidRuntimeException activityNotFound) {
|
||||
ab.setPref(PREF_CONFIGURE_BATTERY, true);
|
||||
}
|
||||
}
|
||||
})
|
||||
.setNegativeButton(R.string.no, new DialogInterface.OnClickListener() {
|
||||
});
|
||||
b.setNegativeButton(R.string.no, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int i) {
|
||||
dialog.cancel();
|
||||
ab.setPref(PREF_CONFIGURE_BATTERY, false);
|
||||
}
|
||||
})
|
||||
.show();
|
||||
});
|
||||
b.show();
|
||||
}
|
||||
} else {
|
||||
ab.setPref(PREF_CONFIGURE_BATTERY, false);
|
||||
|
@ -1,16 +1,23 @@
|
||||
package net.i2p.android.router.service;
|
||||
|
||||
import android.app.Notification;
|
||||
import android.app.NotificationChannel;
|
||||
import android.app.NotificationManager;
|
||||
import android.app.Service;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.SharedPreferences;
|
||||
import android.graphics.Color;
|
||||
import android.os.Build;
|
||||
import android.os.Handler;
|
||||
import android.os.IBinder;
|
||||
import android.os.Message;
|
||||
import android.os.RemoteCallbackList;
|
||||
import android.os.RemoteException;
|
||||
import android.support.annotation.RequiresApi;
|
||||
import android.support.v4.app.NotificationCompat;
|
||||
import android.support.v4.content.LocalBroadcastManager;
|
||||
|
||||
import net.i2p.android.router.R;
|
||||
@ -169,6 +176,9 @@ public class RouterService extends Service {
|
||||
_handler.removeCallbacks(_updater);
|
||||
_handler.postDelayed(_updater, 50);
|
||||
if(!restart) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
|
||||
startOwnForeground();
|
||||
else
|
||||
startForeground(1337, _statusBar.getNote());
|
||||
}
|
||||
|
||||
@ -176,6 +186,31 @@ public class RouterService extends Service {
|
||||
return START_NOT_STICKY;
|
||||
}
|
||||
|
||||
/**
|
||||
* Android 8.1, 9.0, 10 handle foreground applications differently and as such require us to
|
||||
* start our foreground service differently.
|
||||
* */
|
||||
@RequiresApi(api = Build.VERSION_CODES.O)
|
||||
private void startOwnForeground(){
|
||||
String NOTIFICATION_CHANNEL_ID = "com.example.simpleapp";
|
||||
String channelName = "My Background Service";
|
||||
NotificationChannel chan = new NotificationChannel(NOTIFICATION_CHANNEL_ID, channelName, NotificationManager.IMPORTANCE_NONE);
|
||||
chan.setLightColor(Color.BLUE);
|
||||
chan.setLockscreenVisibility(Notification.VISIBILITY_PRIVATE);
|
||||
NotificationManager manager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
assert manager != null;
|
||||
manager.createNotificationChannel(chan);
|
||||
|
||||
NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this, NOTIFICATION_CHANNEL_ID);
|
||||
Notification notification = notificationBuilder.setOngoing(true)
|
||||
.setSmallIcon(R.drawable.i2plogo)
|
||||
.setContentTitle(getString(R.string.running_background))
|
||||
.setPriority(NotificationManager.IMPORTANCE_MIN)
|
||||
.setCategory(Notification.CATEGORY_SERVICE)
|
||||
.build();
|
||||
startForeground(1337, notification);
|
||||
}
|
||||
|
||||
/**
|
||||
* maybe this goes away when the receiver can bind to us
|
||||
*/
|
||||
|
@ -33,7 +33,7 @@ tunnel.1.type=ircclient
|
||||
tunnel.1.sharedClient=true
|
||||
tunnel.1.interface=127.0.0.1
|
||||
tunnel.1.listenPort=6668
|
||||
tunnel.1.targetDestination=irc.dg.i2p:6667,irc.postman.i2p:6667,irc.echelon.i2p:6667
|
||||
tunnel.1.targetDestination=irc.postman.i2p:6667,irc.echelon.i2p:6667
|
||||
tunnel.1.i2cpHost=127.0.0.1
|
||||
tunnel.1.i2cpPort=7654
|
||||
tunnel.1.option.inbound.nickname=shared clients
|
||||
|
@ -1,3 +1,2 @@
|
||||
http://i2p-projekt.i2p/hosts.txt
|
||||
http://i2host.i2p/cgi-bin/i2hostetag
|
||||
http://stats.i2p/cgi-bin/newhosts.txt
|
||||
|
@ -415,4 +415,5 @@
|
||||
<string name="no_market_app">No market app found, please install manually</string>
|
||||
|
||||
<string name="unset">Unset</string>
|
||||
<string name="running_background">I2P is running in the background</string>
|
||||
</resources>
|
||||
|
@ -14,7 +14,7 @@ POM_DEVELOPER_ID=meeh
|
||||
POM_DEVELOPER_NAME=meeh
|
||||
POM_DEVELOPER_EMAIL=meeh@i2pmail.org
|
||||
|
||||
I2P_VERSION=0.9.45
|
||||
I2P_VERSION=0.9.47
|
||||
ANDROID_BUILD_TARGET_SDK_VERSION=28
|
||||
ANDROID_BUILD_SDK_VERSION=28
|
||||
|
||||
|
Reference in New Issue
Block a user