Posts

Showing posts with the label android service

Media files download from firebase using android service

File download from firebase storage using android service

Progress notification for download service in android

Image
Download progress notification for android service Demo screenshot:

Foreground Service with Notification chennal

Example code for notification in foreground service Here we are starting the foreground service from the MainActivity.kt //Start foreground service using notification channel id button.setOnClickListener { val intent = Intent(this, ForeGrService::class.java) intent.putExtra("extraText", editText.text.toString()) // startService(intent) //or ContextCompat.startForegroundService(this, intent) } Stop the service from the Activity class btn_stop.setOnClickListener { val intent: Intent = Intent(this, ForeGrService::class.java) stopService(intent) } onStartComment override method will trigger the notification using channel id in ForegroundService class override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int { val extraText = intent?.getStringExtra("extraText"); if(Build.VERSION.SDK_INT >= Build.VER...