V2TIMOfflinePushInfo struct, you can set the notification title, body, and passthrough extension fields in one place, and finely control push behavior per manufacturer channel (such as priority, notification type, private-message templates, push templates, and custom ringtones).V2TIMOfflinePushInfo and the manufacturer-specific configuration fields (vendorParams), with details and usage examples.Platform | API documentation |
Android | |
iOS | |
C++ | |
C |
Property | Type | Description | Whether visible in the notification bar |
title | String | Offline push notification title. | Visible |
desc | String | Offline push notification body (required for custom messages). | Visible |
ext | byte[] | Passthrough extension field, read in the app after the push is tapped. | Invisible |
disablePush | boolean | Whether to disable this offline push. | Invisible ( true hides the entire notification) |
vendorParams | String(JSON) | Manufacturer extension parameters ( fcmPriority, and others). | Invisible (but still affects display behavior) |
V2TIMOfflinePushInfo.vendorParams passes manufacturer-specific advanced configuration as a JSON string. Combine the following fields as needed. The SDK automatically uses the parameters for the push channel that is finally selected.Feature category | Field | Type | Usage |
FCM message priority | fcmPriority | String | FCM push message priority: "normal": normal priority. When the app is in the foreground, normal-priority messages are delivered immediately. When the app is in the background, delivery may be delayed. For less time-sensitive messages (such as new email notifications, keeping the UI in sync, or syncing app data in the background), use normal priority;"high": high priority. FCM attempts to deliver high-priority messages immediately even if the device is in low-power mode. Use high priority for time-sensitive, user-visible content. |
Push template | pushTemplateId | String | Push template ID. Create and generate the template in the console, then specify it when sending from the client. |
| pushTemplateParam | JSON String | Push template fill parameters. Example: Corresponding template: {appName} sent a message The meeting you joined, at {address}, starts in {time}! Parameter content: { "appName": " TIMPush ", "address":" Meeting room 1908 ", "time":" 3 minutes " } |
V2TIMOfflinePushInfo v2TIMOfflinePushInfo = new V2TIMOfflinePushInfo();Map<String, Object> map = new HashMap<>();map.put("fcmPriority", "high");map.put("pushTemplateId", "templateid");Map<String, Object> pushTemplateParamMap = new HashMap<>();pushTemplateParamMap.put("key1", "value1");map.put("pushTemplateParam", new Gson().toJson(pushTemplateParamMap));String param = new Gson().toJson(map);v2TIMOfflinePushInfo.setVendorParams(param);
val map = mutableMapOf<String, Any>("fcmPriority" to "high","pushTemplateId" to "templateid",)val pushTemplateMap = mapOf("key1" to "value1")map["pushTemplateParam"] = Gson().toJson(pushTemplateMap)val param = Gson().toJson(map)val v2TIMOfflinePushInfo = V2TIMOfflinePushInfo()v2TIMOfflinePushInfo.vendorParams = param
NSMutableDictionary *map = [@{@"fcmPriority": @"high",@"pushTemplateId": @"templateid"} mutableCopy];NSDictionary *pushTemplateParamMap = @{@"key1": @"value1"};NSData *pushTemplateData = [NSJSONSerialization dataWithJSONObject:pushTemplateParamMap options:0 error:nil];NSString *pushTemplateJson = [[NSString alloc] initWithData:pushTemplateData encoding:NSUTF8StringEncoding];[map setObject:pushTemplateJson forKey:@"pushTemplateParam"];NSData *paramsData = [NSJSONSerialization dataWithJSONObject:map options:0 error:nil];NSString *params = [[NSString alloc] initWithData:paramsData encoding:NSUTF8StringEncoding];V2TIMOfflinePushInfo *v2TIMOfflinePushInfo = [[V2TIMOfflinePushInfo alloc] init];v2TIMOfflinePushInfo.vendorParams = params;
var map: [String: Any] = ["fcmPriority": "high","pushTemplateId": "templateid"]let pushTemplateParamMap: [String: String] = ["key1": "value1"]if let pushTemplateData = try? JSONSerialization.data(withJSONObject: pushTemplateParamMap),let pushTemplateJson = String(data: pushTemplateData, encoding: .utf8) {map["pushTemplateParam"] = pushTemplateJson}let paramsData = try! JSONSerialization.data(withJSONObject: map)let params = String(data: paramsData, encoding: .utf8)!let v2TIMOfflinePushInfo = V2TIMOfflinePushInfo()v2TIMOfflinePushInfo.vendorParams = params;
#include <sstream>#include <string>V2TIMOfflinePushInfo offline_push_info;//std::string param = R"({"fcmPriority":"high","vivoNotifyType":4})";std::ostringstream param;// Build the main structparam << "{";param << "\\"fcmPriority\\":\\"high\\",";param << "\\"pushTemplateId\\":\\"templateid\\",";// Build the JSON string for pushTemplateParamstd::string push_template_json = "{\\"key1\\":\\"value1\\"}";param << "\\"pushTemplateParam\\":\\"";for (const char c : push_template_json) {if (c == '"') param << '\\\\';param << c;}param << "\\",";offline_push_info.vendorParams = param.str();
피드백