-
Notifications
You must be signed in to change notification settings - Fork 34
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
Open
IamJoyson
wants to merge
4
commits into
main
Choose a base branch
from
fallback-push
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| import { Image } from "@site/src/components/forDocs"; | ||
|
|
||
| ## Handling Silent Notification for In-App Proactive Engagement Notifications | ||
|
|
||
| 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 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. | ||
| - 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/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. | ||
|
|
||
| #### 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" /> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.