đŸ”Ĩ Normal Service vs Foreground Service – āĻŦ্āϰেāχāύ-āĻĢ্āϰেāύ্āĻĄāϞি āϤুāϞāύা!

 

đŸ”Ĩ Normal Service vs Foreground Service – āĻŦ্āϰেāχāύ-āĻĢ্āϰেāύ্āĻĄāϞি āϤুāϞāύা! 🚀

āφāĻĒāύাāϰ āĻĢোāύেāϰ āĻŦ্āϝাāĻ•āĻ—্āϰাāωāύ্āĻĄে āĻ…āύেāĻ• āĻ•াāϜ āϚāϞে, āĻ•িāύ্āϤু āϏāĻŦ āϏাāϰ্āĻ­িāϏ āĻāĻ•āϰāĻ•āĻŽ āύা!
📌 Normal Service āĻāĻ•āĻĻāĻŽ āϚুāĻĒāϚাāĻĒ āĻ•াāϜ āĻ•āϰে, āχāωāϜাāϰ āϟেāϰāĻ“ āĻĒা⧟ āύা!
📌 Foreground Service Active āĻ­াāĻŦে āĻ•াāϜ āĻ•āϰে, āχāωāϜাāϰāĻ•ে āύোāϟিāĻĢিāĻ•েāĻļāύ āĻĻেāĻ–া⧟!


💡 Normal Service vs Foreground Service – āĻĒাāϰ্āĻĨāĻ•্āϝ!

āĻŦৈāĻļিāώ্āϟ্āϝ 💤 Normal Service đŸ”Ĩ Foreground Service
āĻ•াāϜেāϰ āϧāϰāύ āĻŦ্āϝাāĻ•āĻ—্āϰাāωāύ্āĻĄে āĻ•াāϜ āĻ•āϰে āĻŦ্āϝাāĻ•āĻ—্āϰাāωāύ্āĻĄে āĻ•াāϜ āĻ•āϰāϞেāĻ“ āχāωāϜাāϰāĻ•ে āϜাāύা⧟
User Interaction āύা, āχāωāϜাāϰ āĻ•িāĻ›ুāχ āϟেāϰ āĻĒা⧟ āύা āĻš্āϝাঁ, āύোāϟিāĻĢিāĻ•েāĻļāύ āĻĻেāĻ–া⧟
āύোāϟিāĻĢিāĻ•েāĻļāύ āύেāχ āĻŦাāϧ্āϝāϤাāĻŽূāϞāĻ•
Android Kill āĻ•āϰāϤে āĻĒাāϰে? āĻš্āϝাঁ, āϏāĻšāϜেāχ āύা, āϏāĻšāϜে āĻ•িāϞ āĻ•āϰা āϝা⧟ āύা
Usage Example Data Sync, Alarm, API Calls Music Player, Google Maps, WhatsApp Call
Battery Optimization āĻš্āϝাঁ, āĻŦ্āϝাāϟাāϰি āϏেāĻ­ āĻšā§Ÿ āϤুāϞāύাāĻŽূāϞāĻ• āĻ•āĻŽ āĻŦ্āϝাāϟাāϰি āϏেāĻ­ āĻšā§Ÿ
Priority Level Low High

đŸ”Ĩ āϏāĻšāϜ āωāĻĻাāĻšāϰāĻŖ – Normal vs Foreground Service!

😴 Normal Service (āϚুāĻĒāϚাāĻĒ āĻ•াāϜ āĻ•āϰে)

  • āϧāϰুāύ, āφāĻĒāύাāϰ āĻ…্āϝাāĻĒ āĻŦ্āϝাāĻ•āĻ—্āϰাāωāύ্āĻĄে āĻĄাāϟা āϏিāĻ™্āĻ• āĻ•āϰāĻ›ে!
  • āχāωāϜাāϰ āĻ•োāύোāĻ­াāĻŦেāχ āϜাāύāϤে āĻĒাāϰāĻŦে āύা!
  • āĻ…্āϝাāύ্āĻĄ্āϰ⧟েāĻĄ āϝāĻ–āύ āĻ–ুāĻļি āĻāϟাāĻ•ে Kill āĻ•āϰāϤে āĻĒাāϰে!

👉 Normal Service Example:

class MyNormalService : Service() {
    override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
        // āĻŦ্āϝাāĻ•āĻ—্āϰাāωāύ্āĻĄে āĻ•াāϜ āĻļুāϰু!
        return START_STICKY
    }
    
    override fun onBind(intent: Intent?): IBinder? {
        return null
    }
}

đŸ”Ĩ Foreground Service (āϏāϰাāϏāϰি āχāωāϜাāϰāĻ•ে āϜাāύা⧟!)

  • āϧāϰুāύ, Spotify āĻŦা Google Maps āĻŦ্āϝāĻŦāĻšাāϰ āĻ•āϰāĻ›েāύ!
  • āĻŦ্āϝাāĻ•āĻ—্āϰাāωāύ্āĻĄেāĻ“ āϚāϞāĻŦে, āĻ•িāύ্āϤু āύোāϟিāĻĢিāĻ•েāĻļāύ āĻĻেāĻ–াāĻŦে!
  • āĻ…্āϝাāύ্āĻĄ্āϰ⧟েāĻĄ āϏāĻšāϜে āĻŦāύ্āϧ āĻ•āϰāϤে āĻĒাāϰāĻŦে āύা!

👉 Foreground Service Example:

class MyForegroundService : Service() {
    override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
        val notification = createNotification()
        startForeground(1, notification) // Foreground Service āϚাāϞু!
        return START_STICKY
    }
    
    private fun createNotification(): Notification {
        return NotificationCompat.Builder(this, "channelId")
            .setContentTitle("Foreground Service Running")
            .setContentText("This service is active!")
            .setSmallIcon(R.drawable.ic_notification)
            .build()
    }
    
    override fun onBind(intent: Intent?): IBinder? {
        return null
    }
}

🚀 āĻ•āĻŦে āĻ•োāύāϟা āĻŦ্āϝāĻŦāĻšাāϰ āĻ•āϰāĻŦেāύ?

Normal Service: āϝāĻĻি āĻŦ্āϝাāĻ•āĻ—্āϰাāωāύ্āĻĄে āϚুāĻĒāϚাāĻĒ āĻ•াāϜ āĻ•āϰāϤে āĻšā§Ÿ (āϝেāĻŽāύ, API Call, Data Sync)।
Foreground Service: āϝāĻĻি āχāωāϜাāϰāĻ•ে āϜাāύি⧟ে āĻ•াāϜ āĻ•āϰāϤে āĻšā§Ÿ (āϝেāĻŽāύ, Music Player, Location Tracking)।


đŸŽ¯ āϏংāĻ•্āώেāĻĒে!

  • Normal Service = Background Worker (User āϜাāύে āύা, āϏāĻšāϜে Kill āĻšā§Ÿ!)
  • Foreground Service = High Priority Worker (User āύোāϟিāĻĢিāĻ•েāĻļāύ āĻĒা⧟, āϏāĻšāϜে Kill āĻšā§Ÿ āύা!)

👉 āĻ•াāϜেāϰ āϧāϰāύ āĻŦুāĻে āĻŦেāĻ›ে āύিāύ āĻ•োāύ āϏাāϰ্āĻ­িāϏ āϞাāĻ—āĻŦে! 🚀đŸ”Ĩ

Comments

Popular posts from this blog

AI (Artificial Intelligence) āϏāĻšāϜāĻ­াāĻŦে āĻŦোāĻাāϰ āϜāύ্āϝ āĻāĻ•āĻĻāĻŽ āĻŽāϏ্āϤিāώ্āĻ•-āĻŦাāύ্āϧāĻŦ āĻŦ্āϝাāĻ–্āϝা 🧠🤖

🧠 Regex āĻ•ী?

Kotlin-āĻ āĻ­েāϰিāϝ়েāĻŦāϞ āϘোāώāĻŖা āĻ•āϰাāϰ āĻĻুāχ āωāĻĒাāϝ়