React-native-firebase Bigimage not working in ios - ios

i can not show big image in notification in ios when app close or open , but working in android
var display_notification = new firebase.notifications.Notification({
show_in_foreground: true
})
.setNotificationId(notification._notificationId)
.setTitle(notification._title)
.setBody(notification._body)
.setData(notification._data);
if (Platform.OS == "android") {
display_notification.android
.setChannelId("fcm_default_channel")
.android.setSmallIcon("ic_notification")
.android.setBigPicture(notification._data.picture)
.android.setColor("#171551");
} else {
display_notification.ios.addAttachment(
"1",
"https://files.allaboutbirds.net/wp-content/uploads/2015/06/prow-featured.jpg"
);
}
show notification in ios but not display big-image (rich notification )

You can use IOSNotification
iOS specific notification settings.
NOTE: Some of these settings apply only to iOS 9, or iOS 10+.
These are flagged as appropriate.
launchImage returns nullable string;
Gets the launch image to use with the notification.
setLaunchImage(launchImage) returns Notification;
Sets the launch image for the notification.
launchImage : string
Example
notification
.ios.setLaunchImage('notificationimage.png');
Description of IOSNotification
Description of Displaying Notifications

Related

IOS 13 doesn't play a notification sound using FirebasePushNotificationPlugin

I use Firebase to push notifications to the users at a certain time. They receive the notification but no alert sound is played. In the settings, the allow sound/notifications are turned on and other IOS13 and other apps play sound.
Version Number of FirebasePushNotificationPlugin Plugin: 3.3.10
Device Tested On: iphone X, OS: 13.4.1
Simulator Tested On: N/A (simulators don't receive notifications)
Version of VS: VS for Mac Community, 8.6.6 (build 11)
Version of Xamarin: Xamarin.IOS 13.18.2.1, Xamarin.Forms v4.6.0.847
AppDelegate.cs:
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
bool fbaseStarted = false;
try
{
// This method does all the UNUserNotificationCenter.Current.RequestAuthorization() code so we don't have to.
FirebasePushNotificationManager.Initialize(options, true);
fbaseStarted = true;
}
catch
{ }
LoadApplication(new App());
if (!fbaseStarted)
{
try
{
FirebasePushNotificationManager.Initialize(options, true);
}
catch { }
}
FirebasePushNotificationManager.CurrentNotificationPresentationOption = UNNotificationPresentationOptions.Badge | UNNotificationPresentationOptions.Alert | UNNotificationPresentationOptions.Sound;
}
Within one of the pages of my code, I subscribe a list of tags (please note that I unsubscribe because the first time the code runs it fails silently if the notifications aren't approved - resulting in the model thinking the notifications was subscribed when it wasn't):
CrossFirebasePushNotification.Current.UnsubscribeAll();
CrossFirebasePushNotification.Current.Subscribe(Constants.NotificationTagsArray);
I keep coming across payload json solutions but unless I am wrong, I don't think that applies to me as I am using Xamarin and the FirebasePushNotificationPlugin. Is there any additional permissions that were added in ios 13 for playing notifications with sound that I have missed?
I have also posted here: https://github.com/CrossGeeks/FirebasePushNotificationPlugin/issues/348 but nobody has been able to assist me yet.
Thanks
The issue actually lies with the sending of the notifications nothing to do with the Xamarin App. The issue resided in the services that sends the notifications to firebase (to then be sent out to the phones).
In the service we were sending a FirebaseNet.Messaging.Message() to the phones:
Message FireBasemessage = new Message()
{
To = "/topics/" + PushNote.Tag,
TimeToLive = 86400,
Priority = MessagePriority.high,
ContentAvailable = true,
Notification = new AndroidNotification()
{
Tag = "/topics/" + PushNote.Tag,
Body = enhancedMessage,
Title = xtitle,
}
,
Data = new Dictionary<string, string>
{
{ "param", PushNote.Tag },
{ "text", enhancedMessage}
}
};
In the AndroidNotification() object required Sound = "default" to be added for it to work. Please note that this works for both Android and IOS notifications despite the fact it is an AndroidNotification object.

Xamarin IOS Push Killed app

Push =>
{{
aps = {
alert = {
"loc-args" = (
);
"loc-key" = "new_chat";
};
"content-available" = 1;
id = 3;
message = Aaa;
sound = default;
subject = "new_chat";
type = chat;
};
}}
When the application is killed and I receive a push notification it is shown with the text "new_chat". How can I change it to another text?
Assuming you are targeting iOS 10+, you can add a Notification Services extension app (UNNotificationServiceExtension) to your app bundle.
modifies the content of a remote notification before it is delivered to the user.
In the DidReceiveNotificationRequest override, extract your content from the UNNotificationRequest and modify it and return it via the contentHandler provided.
Required reading to understand how/when the extension is used:
Modifying Content in Newly Delivered Notifications
Also:
Xamarin Docs: iOS Extensions in Xamarin.iOS
Apple docs: UNNotificationServiceExtension

React Native PushNotification IOS can receive push message but without sound

I encountered a problem with PushNotificationIOS using React Native. After I updated RN from 0.48 to 0.54 and upgraded my iPhone with iOS 11.3, my iOS app can receive push message but without sound. The notification part of the code was left untouched and there was no problem with message sound. Just wonder what configuration might need to be made to make the message sound normal. Thanks for your suggestions.
I check the notification object in debugging mode and it got alert title, body, and should value and looks good.
componentWillMount() {
PushNotificationIOS.addEventListener("register", this._onRegistered);
PushNotificationIOS.addEventListener(
"registrationError",
this._onRegistrationError
);
PushNotificationIOS.addEventListener(
"notification",
this._onRemoteNotification
);
PushNotificationIOS.addEventListener(
"localNotification",
this._onLocalNotification
);
}
....
_onRegistered(deviceToken) {
if (deviceToken)
...
console.log("Registered deviceToken=" + deviceToken);
}
_onRemoteNotification(notification) {
notification.finish(PushNotificationIOS.FetchResult.NoData);
var body = notification.getMessage().body.split("|");
if (body.length === 1)
Warn(
notification.getMessage().title, //message only.
body[0],
[{ text: "OK", onPress: null }]
);
else if (body.length === 2) {
//code + message
Warn(notification.getMessage().title, body[0] + "\n" + body[1], [
{ text: "OK", onPress: null }
]);
store.dispatch(sessionActionCreators.updateConfirmCode(body[0]));
}
}
How to make sound when notification came if application is active in ios?
Just found out that forcing to play the sound event if the app is at foreground is possible. Just call the API to play the sound/do vibration.

Unity for iOS push notification has no sound

I'm developing iOS application in Unity. I need to show Local Push Notifications.
I use the next code:
public class TestNotification : MonoBehaviour {
void Start(){
UnityEngine.iOS.NotificationServices.RegisterForNotifications(UnityEngine.iOS.NotificationType.Alert | UnityEngine.iOS.NotificationType.Badge | UnityEngine.iOS.NotificationType.Sound);
}
public void ShowNotification(){
#if UNITY_IOS
var iOSNotification = new UnityEngine.iOS.LocalNotification();
iOSNotification.alertBody = "Hello!";
UnityEngine.iOS.NotificationServices.PresentLocalNotificationNow(iOSNotification);
#else
Debug.LogError("Platform is not supported.");
#endif
}
}
When I call ShowNotification, notification appears in Notification Panel, but without any sound and popup. How to make my notifications show normally? I accepted all permissions(alert, sound, badge) on launch.
Testing Device: iPhone 4s, iOS 9.3.5
Build: Unity 5.4.4f1, XCode 8.2.1
You need to place this code in order to play sound and display alert
iOSNotification.soundName = LocalNotification.defaultSoundName;
iOSNotification.alertAction = "Alert Action";
iOSNotification.hasAction = true;
If you wan sound, you should specify default sound name.
iOSNotification.soundName = "default";
Add this, and it will play default sound.

Push notification badge not updating in iOS 7.1 when app is closed or in background

{
aps = {
alert = "You have assigned 1 new task.";
badge = 1;
sound = "default"
};
}
The same JSON Payload is working in iOS 8+ but not in 7.1
Am I missing something here in payload?
I have checked for the notification settings and it's fine too.

Resources