Deprecation of MegaSound (Beta)
I was at the end of my apprenticeship when I started working on MegaSound. It was the last month in school* and we had nothing really to do anymore. Exams were over and our teachers were burned out from our class.
However, it was at school as I opened my laptop and created a new Android project called SoundControl. The idea was to control each sound of every incoming Notification. Sounds easy, right? But it was way harder then I thought. And the reason was not only the fact that I’ve never developed as a professional before.
To catch each incoming Notification I used to use the NotificationListenerService. These service allow you — after you enable it in your phone settings — to receive each incoming Notification. With the onNotificationPosted() you get directly access to the StatusBarNotification object which contains all information about the Notification and the Application which have send it.
My initial idea was to took advantage of this to — when needed — override the Notification sound. The original sound will be overridden by my custom sound. App users will be happy and I will be rich!
But there was a problem. The listener — or the method — doesn’t get called before a Notification is being posted. Instead it will be called after the Notification is already posted to the StatusBar. Which leads to the fact that the Android System have already played the sound. Or it is just before to play the sound.
Fun fact: I’ve never figured out why it sometimes had already played and something it was just before to play the sound.
So I needed an ugly workaround for that (and probably that was the reason why I didn’t get rich).
My new solution was as easy as creative. Why not just set the Notification Stream to silent and play the custom sound on another Stream with the volume from the Notification Stream? Finger crossed that the Notification Stream is slower than onNotificationPosted() so that the sound hasn’t already started. After the sound got finished, I can set the Notification Stream volume back to the original volume. And yes, it worked!
Sometimes. Depends on. Only if.
Whatever. I’ve some trouble with that solution. The E-Mails I received and the Play Store reviews says everything.
Since I started as a professional I decided to “drop” the “support” (which was never really there) for the App. Not only because I haven’t that much time anymore. But also because the App was build on a “wrong” base. When I started with the implementation I assumed that I got the Notifications before they posted to the StatusBar. Like a Proxy. But that wasn’t right. But because the App works with the workaround I described above and it seemed that a lot of people like that idea (and the implementation because it worked on most of the devices), I decided to leave it published at the Play Store like it is.
Android O for the rescue
But there is hope. Android O is just around the corner (ok, not really. But you know what I mean) and bring the idea of MegaSound directly build in to the OS.
Each developer — which targets to O — have to setup at least one NotificationChannel. These NotificationChannel can have a sound. And these sound can be changed by the user. Once it is changed by an user the developer can’t take control of the settings of this NotificationChannel anymore. Sounds similar to the initial idea of MegaSound, right? Of course, it is!
NotificationChannels bring more features to control Notifications. You can also change the Lights and Vibrations, for example. But that is not the point of that post.
All in all. I thank all of you for your support of MegaSound. I thank you for all of these E-Mails you send. I thank you for all the reviews in the Play Store. All of these were very helpful (for me in personal and for me as a developer!) and some make me very proud.
But now it is time to — finally — close the doors of MegaSound and declare it official as deprecated.
I don’t remove the App from Play Store right now. But don’t expect updates or any kind of support for the App anymore.
* in Germany each apprenticeship contains partly in school for learning theory. Practise will be learned at the company.