0

I currently have audio notifications via Snarl that execute when Gradle builds are complete. Additionally, I use a SharedPreference at OnCreate() to detect the first time that my app is launched, which has a separate audio notification using MediaPlayer.

The first launch method works fine, but there is some lag with the Snarl method (between the Gradle build finishing and the app actually launching).

Is it possible to incorporate a way to explicitly detect that an app has been launched by Android Studio? I'd like to have an audio notification that plays whenever I build the app, but not when the app is launched regularly.

The purpose of this is to make use of build time & get some quick exercise in (it adds up!).

Some possible solutions that I've found are ACTION_PACKAGE_CHANGED, ACTION_PACKAGE_INSTALL, & ACTION_PACKAGE_REPLACED; but I'm not quite sure if they would work for this purpose, or how to implement them.

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Enteleform
  • 3,753
  • 1
  • 15
  • 30
  • You first sentence is very interesting and could answer to [my question](https://stackoverflow.com/questions/53238948/how-to-get-a-notification-when-android-studio-finish-a-build). I followed your links but couldn't figure out how you did. Would you mind to take a look ? – Dan Chaltiel Nov 10 '18 at 19:38

1 Answers1

0

Alternatively you could modify your App run configuration in Android Studio to include intent extra data which would indicate audio notification but would not be present when started from the launcher.

Morrison Chang
  • 11,691
  • 3
  • 41
  • 77