Skip to content
This repository was archived by the owner on Apr 9, 2021. It is now read-only.

Commit a8b82bd

Browse files
Disable notifications for android oreo and above
This is a regression of updating sdk version to 28, Needs to fixed separately
1 parent 6d20817 commit a8b82bd

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

skunkworks_crow/src/main/java/org/odk/share/activities/SendActivity.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,9 @@ private void stopHotspotAlertDialog() {
241241

242242
private void stopHotspot() {
243243
if (isHotspotRunning) {
244-
wifiHotspot.disableHotspot();
244+
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
245+
wifiHotspot.disableHotspot();
246+
}
245247
}
246248

247249
senderService.cancel();

skunkworks_crow/src/main/java/org/odk/share/services/HotspotService.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,11 @@
2424
import android.content.Context;
2525
import android.content.Intent;
2626
import android.content.IntentFilter;
27+
import android.os.Build;
2728
import android.os.Handler;
2829
import android.os.IBinder;
2930
import android.os.Message;
3031

31-
import androidx.annotation.Nullable;
32-
import androidx.core.app.NotificationCompat;
33-
3432
import org.odk.share.R;
3533
import org.odk.share.activities.MainActivity;
3634
import org.odk.share.application.Share;
@@ -41,6 +39,8 @@
4139

4240
import javax.inject.Inject;
4341

42+
import androidx.annotation.Nullable;
43+
import androidx.core.app.NotificationCompat;
4444
import io.reactivex.disposables.CompositeDisposable;
4545

4646

@@ -91,7 +91,10 @@ public void onReceive(Context context, Intent intent) {
9191
};
9292
state = new HotspotState(this);
9393
registerReceiver(stopReceiver, new IntentFilter(ACTION_STOP));
94-
startForeground(HOTSPOT_NOTIFICATION_ID, buildForegroundNotification(getString(R.string.hotspot_start), false));
94+
95+
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
96+
startForeground(HOTSPOT_NOTIFICATION_ID, buildForegroundNotification(getString(R.string.hotspot_start), false));
97+
}
9598
}
9699

97100
@Override

0 commit comments

Comments
 (0)