I’m definitely getting back into Android development, I’m remembering that feeling of ‘Surely this should be easier than this!’. All I wanted to do was to schedule a local notification which behaved similarly to a push notification pop-up. That is, as well as showing the small icon in the status bar I wanted it to pop up on screen to notify the end-user. All seems fairly easily, I found this code for how to schedule a notification. That all worked perfectly, apart from the notification would only appear in the status bar. Searching around I found loads of different answers/solutions, mostly all saying the same thing:
- It only worked if you used ‘NotificationCompat.Builder’ in place of ‘Notification.Builder’, or
- You had to set the priority to ‘NotificationCompat.PRIORITY_HIGH’
As usually happens, none of these solutions worked for me until I added in the missing piece of the jigsaw:- ‘.setDefaults(Notification.DEFAULT_ALL)‘. For me this fixed the problem, the scheduled notification began to pop up on the desktop as expected! Looking into the Android documentation for this method nothing seemed to make sense as to why it would change the behaviour of the notification. As the documentation made reference to default sounds I replaced the call “.setDefaults(…)” with “.setSound(…)” and tried again. Again, the notification behaved as desired and appeared as a pop-up. Not making calls to either of these methods resulted in the notification reverted back the undesired behaviour of only appearing in the status bar. Adding either or both of these calls back in caused the desired behaviour. I’m still not completely sure why at the moment, but adding a sound to the scheduled notification sorted the problem out for me.
These ‘pop-up’ notifications are called “Heads-up” notifications and were introduced with Lollipop (v5.0).
Recently one of our client apps began to experience customers being locked out of their subscription purchased content. The cause of the issue was traced to the other of the transactions in latest_receipt_info in the Apple Receipt
Just recently I’ve been to a few talks about Kotlin and been reading up about Android Architectural Components. I’ve also had an idea for a really basic app playing around in my mind for a while, so it seems a perfect opportunity to kill two birds with one stone. I’ve already had a play with LiveData / ViewModel, updating the Big Nerd Ranch Quiz, which went really well. For this project, I’m also going to . . .