4

Again about notification sound on Android O+. There are some phones where the "notification settings" window doesn't show the sound selection button (and not even the vibration button). Here are a couple examples:

  • Samsung A5
  • Huawei Honor View 10

(not minor brands... I would say)

They were tested with Gmail app (menu -> Settings -> account -> Notification settings) on Android 8.

Here Android O - Notification Channels - Change Vibration Pattern or Sound Type is a solution to avoid the "standard" window, but why should we reinvent the wheel?

Is there any other option that I'm missing?

Thank you,

Max

P.S. Here is a screenshot from a Honor 9 / Android 8.0.0. Channel name is "Mail" ("Posta" in Italian). For sound ("Suoneria" in Italian) there is only an On/Off switch. GMail -> Settings -> account -> Notification Settings

mdicosimo
  • 724
  • 7
  • 19
  • Noone replying: am I overlooking something? I've several users complaining so it should be a common experience... Thank you – mdicosimo Sep 10 '18 at 09:37
  • Can you include a screenshot from one of those devices? By default, users also need to click on the notification channel itself to change advanced settings such as the notification sound. – ianhanniballake Sep 11 '18 at 04:25
  • Added a screenshot I received from a Huawei - Honor 9, showing the "problem". It's exactly the same I received from a Samsung and another Huawei model. Thank you. – mdicosimo Sep 15 '18 at 20:00
  • @mdicosimo do you have any solution for this? – Sagar Oct 17 '18 at 08:26
  • No, I don't. Are you experiencing the same problem? I'm worried that I'm the only one talking about this: maybe I'm overlooking something obvious to solve it... – mdicosimo Oct 18 '18 at 09:24

1 Answers1

0

It's a mess. You need to add workarounds for the different brands/devices. This is the flow we're using to deal with it:

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && !isDeviceWithWorkaround()) {
    // Send to notification channel settings (See https://developer.android.com/training/notify-user/channels#UpdateChannel)
}else{
    Intent intent = new Intent(RingtoneManager.ACTION_RINGTONE_PICKER);
    intent.putExtra(RingtoneManager.EXTRA_RINGTONE_TYPE, RingtoneManager.TYPE_NOTIFICATION);
    intent.putExtra(RingtoneManager.EXTRA_RINGTONE_TITLE, "Sound");
    intent.putExtra(RingtoneManager.EXTRA_RINGTONE_EXISTING_URI, Uri.parse(someExistingRingTone));
    if (isDeviceWithWorkaround()) {
        intent.setPackage("com.android.providers.media"); 
    }
    try {
        startActivityForResult(intent, reqCode);
    } catch (ActivityNotFoundException e) {
        if (isDeviceWithWorkaround()) {
            Log.i(TAG, "Failed to find preferred package [" + intent.getPackage() + "]. Trying again without package.");
            intent.setPackage(null);
            startActivity(intent);
        }
    }
}

So what's happening is that if it's a device with a known issue as you talk about we send them to the good old ringtone picker.

I believe that the package com.android.providers.media doesn't have an activity to start on stock Android, but on Huawei it then opens the Media Store where we get back a ringtone URI that can be used as notification sound. (We don't want the user to end up in some other ringtone picker that might not work. We have always recommended our users to use https://play.google.com/store/apps/details?id=com.angryredplanet.android.rings_extended but it won't work with Huawei on Android 8).

Roy Solberg
  • 18,133
  • 12
  • 49
  • 76