You're videos are just so high quality that I feel like I have to pay for them! how ever I'm in a country that I can't donate you but I watch the adds till the last second! Oh and also I have a video request! PLEASE PLEASE PLEASE Make a tutorial video about how to enable V P N mode in Kotlin! there no videos explaining it and the documents are so confusing!
I'm really enjoying these, they're things I know but your helping me categorise them in my mind, would you consider roughly explaining small code changes for audio users,
Could you please suggest how an activity can communicate with a receiver? What if we want our UI or viewmodel to react to a message rather than just logging it? I couldn't manage to find a "native" solution, so ended up adding a static event subject to the receiver's companion object and subscribing my activity to it.
bro, there's a topic I've struggled for a long time to implement. Please, if you would make a series on implementing a custom assistant from overriding VoiceInteractionServices. I'd SERIOUSLY much appreciate it
I am kinda thinking the same thing because he said in the first part that you can pause your music player app when an app received a phone call action.
A music player is not the UI, it's just the service that plays the music. You can pass other active classes of your app to the broadcast receiver and update them. That either works with Hilt or manually assignment
Isn't it better to register and unregister dynamic receivers in onResume and onPause? In the previous video discussing lifecycle methods, you mentioned that the onDestroy method might sometimes not be called.
Can broadcast receivers be used in situations such as internet disconnection? What should I use to check internet situation? Also thanks for these videos :)
What do you think about using broadcasts and broadcast receivers inside same app, compared to using singleton Rx Observable or Coroutine Flow that are used in multiple places? Apart from obviouse API differences, are there any general reasons why should we stick with broadcasts and broadcast receivers in such situation?
Thanks very interesting and useful. Is it possible register to incoming phone call and our application receive the calling number as parameter please? It will very interesting that our application receive the calling number when is ringing and find and display the client record automatically? Have nice time
If my receiver app is closed and I send a broadcast using an explicit intent, will the receiver app still not be able to receive it, since that's what's happening in my case?
This implementation for the AirPlaneModeReceiver may be more natural and straightforward. class AirPlaneModeReceiver: BroadcastReceiver() { override fun onReceive(context: Context?, intent: Intent?) { if (intent?.action == Intent.ACTION_AIRPLANE_MODE_CHANGED) { if (intent.hasExtra("state")) { val isTurnedOn = intent.getBooleanExtra("state", false) println("Is airplane mode enabled? ${isTurnedOn}") } else { println("No state extra found in the intent") } } } }
I have doubt like how do we update the UI from the receviers. If it is possible with viewmodel i have a question passing a viewmodel instance to broadcast receiver is a good way?
I couldn't manage to find a "native" solution, so ended up adding a static event subject to the receiver's companion object and subscribing my activity (or viewmodel) to it.
00:03 Broadcasts in Android are system-wide events that apps can consume and receive 01:30 Reacting to airplane mode changes in an Android app 02:51 Handling intents in Android 04:19 Registering a broadcast receiver for airplane mode changes. 05:50 Dynamic broadcast allows receiver declaration when needed 07:12 Static broadcast receivers can be declared in the Manifest file 08:27 Sending and receiving broadcast intents in Android 10:07 Apps can communicate with each other using broadcast receivers.
I am little confiused, I can see you used the intent action in the airPlane brodcast class, why you set this action again to the intentFilter inside the register? Also one more thing.. in your note application you made getNote() not suspended but you made getAllNotes() are suspended Why? Both of them are returning data from room Sorry for grammer mistakes
to getAllNodes, you execute a task with a fewer seconds, from Room Local Database for example. Suspend fun refers to call it function into a Coroutine, for example in your viewModel, you need to call this function into viewModelScope.launch{}. Whatever getNote, can be non suspend fun, but instead of that, you shoul to be return Flow, and works same if you define that : suspend fun getNote() : NoteEntity Boths works similar, but generally Flow is expected when you call a list that have changes along the time or running of the app, reacts, to actions, it mutates. Suspend fun refers, when you create a coroutine that gives some work, and it;s no frequently to mutate. Does Work right. Suspend fun with no returns -> Procedure, fun with returns -> Works and return Type. also suspend can be used to return.