Skip to content

Commit c457ba1

Browse files
committed
Bump to compile and target sdk 26. Introduce a notification channel for the debugport notification.
1 parent 2fa37b5 commit c457ba1

File tree

6 files changed

+29
-17
lines changed

6 files changed

+29
-17
lines changed

app/build.gradle

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
apply plugin: 'com.android.application'
22

33
android {
4-
compileSdkVersion 25
5-
buildToolsVersion '25.0.2'
4+
compileSdkVersion 26
5+
buildToolsVersion '26.0.1'
66

77
defaultConfig {
88
applicationId "jwf.debugport.app"
9-
minSdkVersion 9
10-
targetSdkVersion 25
9+
minSdkVersion 14
10+
targetSdkVersion 26
1111
versionCode 1
1212
versionName "1.0"
1313
}
@@ -22,7 +22,7 @@ android {
2222
dependencies {
2323
compile fileTree(dir: 'libs', include: ['*.jar'])
2424
testCompile 'junit:junit:4.12'
25-
compile 'com.android.support:appcompat-v7:25.3.1'
25+
compile 'com.android.support:appcompat-v7:26.1.0'
2626

2727
debugCompile project(':lib')
2828
releaseCompile project(':lib-noop')

build.gradle

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ buildscript {
55
jcenter()
66
}
77
dependencies {
8-
classpath 'com.android.tools.build:gradle:2.3.1'
8+
classpath 'com.android.tools.build:gradle:2.3.3'
99
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
1010
}
1111
}
@@ -14,6 +14,7 @@ allprojects {
1414
repositories {
1515
jcenter()
1616
maven { url "https://jitpack.io" }
17+
maven { url 'https://maven.google.com' }
1718
}
1819
}
1920

lib-noop/build.gradle

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ apply plugin: 'maven'
44
group='com.github.jasonwyatt'
55

66
android {
7-
compileSdkVersion 25
8-
buildToolsVersion "25.0.2"
7+
compileSdkVersion 26
8+
buildToolsVersion "26.0.1"
99

1010
defaultConfig {
11-
minSdkVersion 9
12-
targetSdkVersion 25
11+
minSdkVersion 14
12+
targetSdkVersion 26
1313
versionCode 5
14-
versionName "2.0.0"
14+
versionName "2.1.0"
1515
}
1616
}
1717

lib/build.gradle

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,20 @@ apply plugin: 'maven'
44
group='com.github.jasonwyatt'
55

66
android {
7-
compileSdkVersion 25
8-
buildToolsVersion '25.0.2'
7+
compileSdkVersion 26
8+
buildToolsVersion '26.0.1'
99

1010
defaultConfig {
11-
minSdkVersion 9
12-
targetSdkVersion 25
11+
minSdkVersion 14
12+
targetSdkVersion 26
1313
versionCode 5
14-
versionName "2.0.0"
14+
versionName "2.1.0"
1515
}
1616
}
1717

1818
dependencies {
1919
compile "org.apache-extras.beanshell:bsh:2.0b6"
20-
compile "com.android.support:support-compat:25.3.1"
20+
compile "com.android.support:support-compat:26.1.0"
2121
}
2222

2323
// build a jar with source files

lib/src/main/java/jwf/debugport/DebugPortService.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package jwf.debugport;
22

33
import android.app.Notification;
4+
import android.app.NotificationChannel;
5+
import android.app.NotificationManager;
46
import android.app.PendingIntent;
57
import android.app.Service;
68
import android.content.Context;
@@ -9,6 +11,7 @@
911
import android.content.pm.PackageManager;
1012
import android.content.res.Resources;
1113
import android.os.AsyncTask;
14+
import android.os.Build;
1215
import android.os.Bundle;
1316
import android.os.IBinder;
1417
import android.os.PowerManager;
@@ -27,6 +30,7 @@
2730
*/
2831
public class DebugPortService extends Service {
2932
private static final String TAG = "DebugPortService";
33+
private static final String NOTIFICATION_CHANNEL = "androiddebugport";
3034
public static final String METADATA_DEBUG_PORT = "jwf.debugport.METADATA_DEBUG_PORT";
3135
public static final String METADATA_SQLITE_PORT = "jwf.debugport.METADATA_SQLITE_PORT";
3236
public static final String METADATA_STARTUP_COMMANDS = "jwf.debugport.METADATA_STARTUP_COMMANDS";
@@ -163,6 +167,11 @@ public void onDestroy() {
163167
}
164168

165169
private Notification buildNotification(@Nullable Params params) {
170+
NotificationManager mgr = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
171+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
172+
mgr.createNotificationChannel(new NotificationChannel(NOTIFICATION_CHANNEL, getString(R.string.debugport_notification_channel_name), NotificationManager.IMPORTANCE_MIN));
173+
}
174+
166175
if (params == null) {
167176
params = getManifestParams(this);
168177
}
@@ -191,6 +200,7 @@ private Notification buildNotification(@Nullable Params params) {
191200
builder.setContentText(message);
192201
builder.addAction(mServersStarted ? buildStopAction() : buildStartAction(params));
193202
builder.addAction(buildKillAction());
203+
builder.setChannelId(NOTIFICATION_CHANNEL);
194204

195205
return builder.build();
196206
}

lib/src/main/res/values/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@
88
<string name="debugport_notification_action_stop">Stop</string>
99
<string name="debugport_notification_action_start">Start</string>
1010
<string name="debugport_notification_action_kill">Kill</string>
11+
<string name="debugport_notification_channel_name">Android DebugPort</string>
1112
</resources>

0 commit comments

Comments
 (0)