diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index ba89d15..e619b30 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -2,6 +2,8 @@ + + - + \ No newline at end of file diff --git a/app/src/main/java/com/example/broadcasts/ReceiverService.kt b/app/src/main/java/com/example/broadcasts/ReceiverService.kt index da75a09..55822ca 100644 --- a/app/src/main/java/com/example/broadcasts/ReceiverService.kt +++ b/app/src/main/java/com/example/broadcasts/ReceiverService.kt @@ -4,6 +4,7 @@ import android.app.Service import android.content.Intent import android.content.IntentFilter import android.os.IBinder +import androidx.core.app.NotificationCompat class ReceiverService: Service() { @@ -15,6 +16,11 @@ class ReceiverService: Service() { override fun onCreate() { super.onCreate() + val notification = NotificationCompat.Builder(this, "default_notifications") + .setSmallIcon(R.drawable.ic_launcher_background) + .setContentTitle("Listening for Airplanemode change") + .build() + startForeground(2, notification) registerReceiver( airplaneModeChangedReceiver, IntentFilter(Intent.ACTION_AIRPLANE_MODE_CHANGED)