Skip to main content

3 posts tagged with "Android"

View All Tags

· 3 min read

Why?

Update: scrcpy 2.0+ supports Audio forwarding. You don't need sndcpy anymore. Thanks Romain Vimont.

I want to listen to the instructor playing on an Android app (Fiit) on my speakers which are connected to my MacBook. I am already sharing the screen of my Android on my MacBook by using scrcpy, a tool by Romain Vimont. sndcpy lets us to do this, also a tool made by Romain Vimont. The naming of these tools were inspired by C library function, strcpy, which copies strings between memory locations.

You want to play music or app sounds on your Android device on your macOS, and

  • You are displaying your Android screen on the mac already, but you want sound too
  • Your Android device doesn't have an audio jack
  • Your speakers aren't bluetooth
  • You don't want to use your headphones
    • I do not want to sweat onto my headphones, or
    • I want to share my music with others
  • Your macOS is connected via AUX cable (or USB-C/HDMI) to speakers, so let's use them instead

· 3 min read

Being cross-platform, Flutter abstracts away Platform APIs, such as iOS, Android, Web, macOS, Windows and Linux. However, there are platform specific differences which will affect how you implement features or develop package plugins.

For example, on iOS, you need to implement didReceive(_:completionHandler:) in your app's main entrypoint (AppDelegate), where as on Android, you need to declare a Service or Broadcast Receiver in the AndroidManifest.xml file, and override FirebaseMessagingService onMessageReceived method.

· 3 min read

Motivation

You may want to observe/ debug behaviour related to your app's Activity, Broadcast Receiver or Service being launched by an Intent, without any side effects of the application already running. For example, I was testing push notifications, and wanted to debug the case where no other application components was running (Activity, Service), and only the Broadcast Receiver declared in my AndroidManifest.xml was launched in response to the push notification message. This is only possible if the application hasn't been launched yet by Android Studio.

The trick is prevent your app from launching until the debugger is attached, and then to attach the debugger. This means you won't miss anything between the app launching and you attaching the debugger.