-
Notifications
You must be signed in to change notification settings - Fork 31
Document silent configuring for iOS #210
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| import { Admonition, TabItem, Tabs } from "@site/src/components/forDocs"; | ||
|
|
||
| 3. Implement background handler in `AppDelegate`. | ||
|
|
||
| <Tabs groupId="ios-languages"> | ||
| <TabItem value="Objective-C" label="Objective-C"> | ||
| ```objc | ||
| - (void)application:(UIApplication *)application | ||
| didReceiveRemoteNotification:(NSDictionary *)userInfo | ||
| fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler { | ||
|
|
||
| NSString *origin = userInfo[@"origin"]; | ||
|
|
||
| if ([origin isKindOfClass:[NSString class]] && [origin isEqualToString:@"helpshift"]) { | ||
| // Call the Helpshift background handler and pass the completion block | ||
| [Helpshift handleSilentBackgroundNotification:userInfo withCompletionHandler:completionHandler]; | ||
| } | ||
| } | ||
|
|
||
| ```` | ||
| </TabItem> | ||
| <TabItem value="Swift" label="Swift"> | ||
| ```swift | ||
| func application( | ||
| _ application: UIApplication, | ||
| didReceiveRemoteNotification userInfo: [AnyHashable : Any] | ||
| ) async -> UIBackgroundFetchResult { | ||
| let origin = userInfo["origin"] as? String | ||
| if origin == "helpshift" { | ||
| return await Helpshift.handleSilentBackgroundNotification(userInfo) | ||
| } | ||
| return .noData | ||
| } | ||
| ```` | ||
|
|
||
| </TabItem> | ||
| </Tabs> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| import { Image } from "@site/src/components/forDocs"; | ||
| import AndroidInAppSample from "@site/docs/_partials/_proactiveAnd_inappSamples.mdx"; | ||
|
|
||
| ## Handling Silent notification for in-app | ||
|
|
||
| By default, in-app notifications are sent directly to the device's notification tray as fallback push notifications. | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In-App instead of "in-app"
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. By default, In-App notifications are sent directly to the device's notification tray, as fallback push notifications, if your application is in background/killed state. |
||
| However, you can configure the SDK to display notification exclusively as in-app notification while the user is actively using the app. | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. However, you can configure the SDK to display notification exclusively as In-App notification and show up only when the user is actively using the app. |
||
|
|
||
| - If the app is terminated by the system, silent pushes may not wake it. | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These 3 points were supposed to be in a note i assume. Did you change it? |
||
| - Background delivery is not guaranteed: silent notifications are best-effort and may be delayed or dropped when the system is low on resources or the app has been force-quit. | ||
| - When silent notifications are enabled and fallback push is disabled, you can't use this feature to reach or re-engage inactive users. Because in-app notifications only appear when the app is in the foreground. | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When silent notifications are enabled/handled in your app but fallback push is disabled, you can't use this feature to reach or re-engage inactive users. In-App notifications are displayed only when the app is in the foreground. Please check if the re-wording is correct. |
||
|
|
||
| #### Implementation Steps | ||
|
|
||
| 1. Enable background remote notifications in Xcode: | ||
|
|
||
| > **_Xcode → Capabilities → Background Modes → Remote Notifications_** | ||
|
|
||
| <Image width="full !p-0" src="/static/books/sdkx_ios/background-modes.png" /> | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Title could be: "Handling Silent Notification for In-App Proactive Engagement Notifications"