Skip to content

Commit 519a596

Browse files
committed
#299 fix runtime error on Android O
1 parent edf9a72 commit 519a596

File tree

4 files changed

+14
-8
lines changed

4 files changed

+14
-8
lines changed

examples/app/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ allprojects {
2323
jcenter()
2424
mavenCentral()
2525
mavenLocal()
26+
maven { url "https://maven.google.com" }
2627
}
2728
}
2829

examples/app/demoapp/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ apply plugin: 'com.android.application'
22
apply plugin: 'android-apt'
33
apply plugin: 'com.getkeepsafe.dexcount'
44

5-
def sdkVersion = 25;
5+
def sdkVersion = 26;
66
def libraryVersion = "3.3.1"
77

88
android {
99
compileSdkVersion sdkVersion
10-
buildToolsVersion '25.0.2'
10+
buildToolsVersion '26.0.1'
1111

1212
defaultConfig {
1313
applicationId "net.gotev.uploadservicedemo"
@@ -29,7 +29,7 @@ repositories {
2929
}
3030

3131
def butterKnifeVersion = "8.5.1"
32-
def supportVersion = "25.3.1"
32+
def supportVersion = "26.0.0"
3333
def stethoVersion = "1.4.2"
3434

3535
dependencies {

examples/app/demoapp/src/main/java/net/gotev/uploadservicedemo/App.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public void onCreate() {
3838
.enableWebKitInspector(Stetho.defaultInspectorModulesProvider(this))
3939
.build());
4040

41-
enableStrictMode();
41+
//enableStrictMode();
4242
}
4343

4444
// Set your application namespace to avoid conflicts with other apps

uploadservice/src/main/java/net/gotev/uploadservice/UploadTask.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,19 +117,24 @@ public UploadTask() {
117117
*/
118118
protected void init(UploadService service, Intent intent) throws IOException {
119119
this.notificationManager = (NotificationManager) service.getSystemService(Context.NOTIFICATION_SERVICE);
120+
this.params = intent.getParcelableExtra(UploadService.PARAM_TASK_PARAMETERS);
121+
this.service = service;
122+
this.mainThreadHandler = new Handler(service.getMainLooper());
123+
120124
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
121125
String notificationChannelId = params.notificationConfig.getNotificationChannelId();
126+
122127
if (notificationChannelId == null) {
128+
params.notificationConfig.setNotificationChannelId(UploadService.NAMESPACE);
123129
notificationChannelId = UploadService.NAMESPACE;
124130
}
131+
125132
if (notificationManager.getNotificationChannel(notificationChannelId) == null) {
126-
NotificationChannel channel = new NotificationChannel(notificationChannelId, "Upload Service channel", NotificationManager.IMPORTANCE_DEFAULT);
133+
NotificationChannel channel = new NotificationChannel(notificationChannelId, "Upload Service channel", NotificationManager.IMPORTANCE_HIGH);
127134
notificationManager.createNotificationChannel(channel);
128135
}
129136
}
130-
this.service = service;
131-
this.mainThreadHandler = new Handler(service.getMainLooper());
132-
this.params = intent.getParcelableExtra(UploadService.PARAM_TASK_PARAMETERS);
137+
133138
}
134139

135140
@Override

0 commit comments

Comments
 (0)