Two notification alarms if android group key is set
I am using this library to send push notifications to a react native app running on android and iphone devices. It all works well except that I hear the notification sound twice and the phone vibrates twice on Android devices for any notification that I set android_group. When this happens, only one notification shows in the shade and only one event gets fired, so I believe the phone is receiving only one notification. I have this problem only with Android devices and only if android_group is set in the notification. This problem occurs if I send the notification with onesignal's REST api or their web interface.
I need to resolve this because I need to set android_group in the push notifications to ensure that if multiple notifications were sent, they all get grouped together and the user can clear all of them at once. I've pasted the content of my AndroidManifest.xml file below in case it contains any useful info.
Thank you so much for this amazing library and all the good work. Much appreciated!
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.myapp"
android:versionCode="41"
android:versionName="2017.12.26">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<!-- Precise location If you want to use promptLocation for letting OneSignal know the user location. -->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-sdk
android:minSdkVersion="16"
android:targetSdkVersion="22" />
<application
android:name=".MainApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme">
<meta-data
android:name="com.bugsnag.android.API_KEY"
android:value="<deleted>" />
<activity
android:name=".SplashActivity"
android:label="@string/app_name"
android:launchMode="singleTop"
android:exported="true"
android:theme="@style/SplashTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".MainActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:label="@string/app_name"
android:launchMode="singleTop"
android:windowSoftInputMode="adjustResize"
android:exported="true"
/>
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
<!-- Sets all OneSignal notification's accent color to our primaryColor by default. -->
<!-- Color format is in ARGB i.e., the 1st 2 characters are not part of the color -->
<meta-data
android:name="com.onesignal.NotificationAccentColor.DEFAULT"
android:value="FF673AB7" />
</application>
</manifest>
Hi @kesiena115 , I am unable to reproduce this issue. If you are still encountering this problem with duplicates, could you send me an example of the JSON you're sending to OneSignal to create the notification? Or if you are sending the notification via the web dashboard, can you tell me some of the settings you are using?
@Nightsd01 I'm experiencing this issue as well.
$segments[] = "All";
$heading = array(
"en" => "Heading"
);
$content = array(
"en" => 'Message'
);
// Add to fields when neccesary
$fields = array(
'app_id' => $appid,
'isIos' => true,
'isAndroid' => true,
'data' => array(
"url" => 'Some URL',
"id" => 'Some ID',
"image" => 'Some URL',
),
'large_icon' => 'Some URL',
'android_group' => "Some Group ID",
'android_group_message' => '{ "en" : "Some message $[notif_count]"}',
'buttons' => array(
array(
"id" => "add",
"text" => "Add"
),
array(
"id" => "share",
"text" => "Share"
)
),
'headings' => $heading,
'contents' => $content
);
$fields[ 'included_segments' ] = $segments;
$fields[ 'excluded_segments' ] = ['Some Segment'];
@jkasten2 I have been unable to reproduce this issue, perhaps you have an idea here?
@Nightsd01 you can re-create this issue by setting android_group in the JSON or by setting Group Key in the web dashboard. You simply need to set these fields to any value. In my case, it always vibrates and play the sound twice whenever I set that field. I experience this only on Android and I experience it constantly. This was not happening in the past. I only started noticing it few days before I created this issue. The version in my package.json is:
"react-native-onesignal": "^3.0.5",
@Nightsd01 and @jkasten2 I have done a few more tests with multiple devices and emulators. I noticed this problem exists only in the latest Android OS, so I guess it started happening after I updated my phone OS. I don't know the earliest Android OS that introduces this problem. However, I know this problem exists in Android 8.1.0 but it does not exist in Android 5.0.2.
It's perhaps worth mentioning that I do not experience this problem in any other mobile app, so I reckon it should be possible to make a change that allows us to group notifications without having to hear the notification sound twice.
Hello @kesiena115 , I'm sorry we didn't get back to you. Is this still an issue for you?
Closing due to no response