IMSDK
IM features a comprehensive suite of solutions including global access, one-to-one chat, group chat, message push, profile and relationship chain hosting, and account authentication. It also provides complete app access and backend management APIs.
V2TIMOfflinePushInfo

Public Member Functions

 V2TIMOfflinePushInfo ()
 
String getTitle ()
 
void setTitle (String title)
 
String getDesc ()
 
void setDesc (String description)
 
void setExt (byte[] ext)
 
byte [] getExt ()
 
void disablePush (boolean disable)
 
boolean isDisablePush ()
 
void setIOSSound (String sound)
 
void setAndroidSound (String sound)
 
void setIgnoreIOSBadge (boolean ignoreIOSBadge)
 
void setAndroidOPPOChannelID (String channelID)
 
void setAndroidFCMChannelID (String channelID)
 
void setAndroidXiaoMiChannelID (String channelID)
 
void setAndroidVIVOClassification (int classification)
 
void setAndroidVIVOCategory (String category)
 
void setIOSPushType (int iosPushType)
 
void setAndroidHuaWeiCategory (String category)
 
void setAndroidHuaWeiImage (String imageUrl)
 
void setAndroidHonorImage (String imageUrl)
 
void setAndroidFCMImage (String imageUrl)
 
void setIOSImage (String imageUrl)
 
void setHarmonyImage (String imageUrl)
 
void setHarmonyCategory (String category)
 
void setIgnoreHarmonyBadge (boolean ignoreHarmonyBadge)
 

Static Public Attributes

static final String IOS_OFFLINE_PUSH_NO_SOUND = "push.no_sound"
 
static final String IOS_OFFLINE_PUSH_DEFAULT_SOUND = "default"
 
static final int IOS_OFFLINE_PUSH_TYPE_APNS = 0
 
static final int IOS_OFFLINE_PUSH_TYPE_VOIP = 1
 

Constructor & Destructor Documentation

◆ V2TIMOfflinePushInfo()

Member Function Documentation

◆ getTitle()

String getTitle ( )
inline

Get the offline push notification title

Returns
Notification title

◆ setTitle()

void setTitle ( String  title)
inline

Set the offline push display title

Parameters
titleNotification bar title

◆ getDesc()

String getDesc ( )
inline

Get the offline push notification content

Returns
Notification content

◆ setDesc()

void setDesc ( String  description)
inline

Set the offline push notification content

Attention
This field must be set for custom message offline push.
Parameters
descriptionNotification content

◆ setExt()

void setExt ( byte []  ext)
inline

Set the extended field passed through by offline push

Parameters
extNotification passthrough message

◆ getExt()

byte [] getExt ( )
inline

Get the extended field passed through by offline push

◆ disablePush()

void disablePush ( boolean  disable)
inline

Whether to disable push (enabled by default)

Parameters
disabletrue: disable; false: enable

◆ isDisablePush()

boolean isDisablePush ( )
inline

Get whether offline push is disabled

Returns
true: disabled; false: enabled

◆ setIOSSound()

void setIOSSound ( String  sound)
inline

Set the sound effect for offline push (valid only for iOS). If "sound" is IOS_OFFLINE_PUSH_NO_SOUND, no sound will be played when a notification is received. If "sound" is IOS_OFFLINE_PUSH_DEFAULT_SOUND, the system notification sound will be played when a notification is received. To customize the sound, link an audio file to your Xcode project and set iOSSound to the filename (including the extension).

Parameters
soundPath of the audio file for iOS systems

◆ setAndroidSound()

void setAndroidSound ( String  sound)
inline

Set the sound effect for offline push (valid only for Android and supported in imsdk 6.1 and later versions).

Only Huawei and Google phones support configuring sound effects for offline push notifications. To configure offline push sound effects for Xiaomi phones, please see https://dev.mi.com/console/doc/detail?pId=1278%23_3_0. For FCM notifications on Google phones, in order for the configured sound effect to take effect, you need to call setAndroidFCMChannelID to set the channel ID first.

Parameters
soundThe name of the audio file in the raw directory of your Android project (leave out the extension)

◆ setIgnoreIOSBadge()

void setIgnoreIOSBadge ( boolean  ignoreIOSBadge)
inline

Whether to exclude an offline push notification from the badge count (valid only for iOS). If the parameter is set to true, on an iOS device, the app's unread badge will not increase after the notification is sent.

Parameters
ignoreIOSBadgetrue: exclude the offline push notification from the badge count; false: include the offline push notification in the badge count

◆ setAndroidOPPOChannelID()

void setAndroidOPPOChannelID ( String  channelID)
inline

Configure the channel ID for offline push on OPPO phones with Android 8.0 and later

Parameters
channelIDOPPO phone channel ID

◆ setAndroidFCMChannelID()

void setAndroidFCMChannelID ( String  channelID)
inline

Configure the channel ID for FCM offline push on phones with Android 8.0 and later

Parameters
channelIDFCM Channel ID

◆ setAndroidXiaoMiChannelID()

void setAndroidXiaoMiChannelID ( String  channelID)
inline

Configure the channel ID for offline push on Xiaomi phones with Android 8.0 and later

Parameters
channelIDXiaoMi Channel ID

◆ setAndroidVIVOClassification()

void setAndroidVIVOClassification ( int  classification)
inline

Set the notification type for offline push on vivo phones (to be deprecated). The vivo push service optimized its message classification rules on April 3, 2023. We recommend you use setAndroidVIVOCategory instead.

Parameters
classificationOffline push notification type on vivo phones. 0: operation notification; 1 (default): system notification.

◆ setAndroidVIVOCategory()

void setAndroidVIVOCategory ( String  category)
inline

Set the notification type for offline push on vivo phones. For details, see https://dev.vivo.com.cn/documentCenter/doc/359. The vivo push service optimized its message classification rules on April 3, 2023. We recommend you use this API now instead of setAndroidVIVOClassification.

Parameters
categoryNotification type on vivo phones

◆ setIOSPushType()

void setIOSPushType ( int  iosPushType)
inline

Set the offline push type for iOS systems

Parameters
iosPushTypeIOS_OFFLINE_PUSH_TYPE_APNS: APNs; IOS_OFFLINE_PUSH_TYPE_VOIP: VoIP. The default value is IOS_OFFLINE_PUSH_TYPE_APNS

◆ setAndroidHuaWeiCategory()

void setAndroidHuaWeiCategory ( String  category)
inline

Set the offline push notification type for Huawei phones. For details, see https://developer.huawei.com/consumer/cn/doc/development/HMSCore-Guides/message-classification-0000001149358835

Parameters
categoryHuawei push notification type

◆ setAndroidHuaWeiImage()

void setAndroidHuaWeiImage ( String  imageUrl)
inline

Set the notification image for Huawei device offline push.

Parameters
imageUrlThe protocol used must be HTTPS. Here is an example of the value: https://example.com/image.png
Attention
The image file should be smaller than 512KB and the recommended dimensions are 40dp x 40dp with a corner radius of 8dp. Images that exceed the recommended dimensions may be compressed or displayed incompletely. It is recommended to use the JPG/JPEG/PNG image formats.

◆ setAndroidHonorImage()

void setAndroidHonorImage ( String  imageUrl)
inline

Set the notification image for Honor device offline push.

Parameters
imageUrlThe protocol used must be HTTPS. Here is an example of the value:https://example.com/image.png
Attention
The icon file size must be smaller than 100KB. The recommended dimensions for the icon are 160px x 160px with a corner radius of 32px. Icons that exceed the recommended dimensions may be compressed or displayed incompletely.

◆ setAndroidFCMImage()

void setAndroidFCMImage ( String  imageUrl)
inline

Set the notification image for Google FCM device offline push. Display as a large icon when the message is not expanded, and show as a large image when the message is expanded.

Parameters
imageUrlThe protocol used must be HTTPS. Here is an example of the value:https://example.com/image.png
Attention
The icon file size must be smaller than 1 MB. Icons that exceed the specified size may be compressed or displayed incompletely.

◆ setIOSImage()

void setIOSImage ( String  imageUrl)
inline

Set the notification image for APNs offline push, leveraging the iOS 10 Service Extension feature to download and display it in the popup.

Parameters
imageUrlThe protocol used must be HTTPS. Here is an example of the value:https://example.com/image.png
Attention
  • Image: Supports JPEG, GIF, PNG formats with a maximum size of 10 MB.
  • To enable the iOS 10 Service Extension feature, you need to open the "mutable-content" property in the IM console.
  • The key value to retrieve the imageUrl resource is "image".

◆ setHarmonyImage()

void setHarmonyImage ( String  imageUrl)
inline

Set the notification image for offline push by Harmony device.

Parameters
imageUrlThe protocol used must be HTTPS. Example value: https://example.com/image.png.
Attention
Note: Supported image formats are png, jpg, jpeg, heif, gif, bmp. The image dimensions (length * width) must be less than 25000 pixels.

◆ setHarmonyCategory()

void setHarmonyCategory ( String  category)
inline

Set the offline push notification category for HarmonyOS devices. For details, see https://developer.huawei.com/consumer/cn/doc/HMSCore-Guides/message-classification-0000001149358835

Parameters
categoryHarmonyOS devices push notification category

◆ setIgnoreHarmonyBadge()

void setIgnoreHarmonyBadge ( boolean  ignoreHarmonyBadge)
inline

Whether to exclude an offline push notification from the badge count (valid only for Harmony). If the parameter is set to true, on an Harmony device, the app's unread badge will not increase after the notification is sent.

Parameters
ignoreHarmonyBadgetrue: exclude the offline push notification from the badge count; false: include the offline push notification in the badge count

Field Documentation

◆ IOS_OFFLINE_PUSH_NO_SOUND

final String IOS_OFFLINE_PUSH_NO_SOUND = "push.no_sound"
static

◆ IOS_OFFLINE_PUSH_DEFAULT_SOUND

final String IOS_OFFLINE_PUSH_DEFAULT_SOUND = "default"
static

◆ IOS_OFFLINE_PUSH_TYPE_APNS

final int IOS_OFFLINE_PUSH_TYPE_APNS = 0
static

◆ IOS_OFFLINE_PUSH_TYPE_VOIP

final int IOS_OFFLINE_PUSH_TYPE_VOIP = 1
static