製品アップデート情報
Tencent Cloudオーディオビデオ端末SDKの再生アップグレードおよび承認チェック追加に関するお知らせ
TRTCアプリケーションのサブスクリプションパッケージサービスのリリースに関する説明について



google-services.json file required for offline push.Vendor Push Platform | IM Console Configuration |
![]() | ![]() |
timpush-configs.json file in your app module's assets directory, and add google-services.json to your project's app directory.Download the file timpush-configs.json | Download file google-services.json | Add to your project |
![]() | ![]() | ![]() |
app module build.gradle file:implementation "com.tencent.timpush:timpush:latest.release"implementation "com.tencent.timpush:fcm:latest.release"
tuicallkit-kt/build.gradle file.buildscript > dependencies section of your project-level build.gradle file:buildscript {dependencies {classpath 'com.google.gms:google-services:4.3.15'}}
build.gradle file, apply the following plugin:apply plugin: 'com.google.gms.google-services'
build.gradle file, set the applicationId to your actual app package name:applicationId 'com.****.callkit'
import android.content.BroadcastReceiverimport android.content.Contextimport android.content.Intentimport android.content.IntentFilterimport android.os.Bundleimport androidx.localbroadcastmanager.content.LocalBroadcastManagerclass PushWakeupReceiver : BroadcastReceiver() {override fun onReceive(context: Context?, intent: Intent?) {if (intent?.action == "TIMPush.BROADCAST_IM_LOGIN_AFTER_APP_WAKEUP") {val bundle = intent.getExtras()// 2.Execute Auto-Login// autoLogin()}}}class MainActivity : AppCompatActivity() {private val wakeupReceiver = PushWakeupReceiver()private var callListener: CallListener? = nulloverride fun onCreate(savedInstanceState: Bundle?) {super.onCreate(savedInstanceState)// 1.Listen for App Wakeup BroadcastobserveAppWeakup()}private fun observeAppWeakup() {val filter = IntentFilter("TIMPush.BROADCAST_IM_LOGIN_AFTER_APP_WAKEUP")LocalBroadcastManager.getInstance(this).registerReceiver(wakeupReceiver, filter)}}
NotificationManager class to display a custom incoming call notification interface:IncomingCallNotificationManager): Encapsulate the logic for creating and displaying notifications.RemoteViews to define the notification layout. For details on configuring notifications with NotificationCompat.Builder (such as Channel, PendingIntent, priority, etc.), refer to the Android documentation: NotificationCompat.Builder.import android.app.Notificationimport android.app.NotificationChannelimport android.app.NotificationManagerimport android.content.Contextimport android.content.Intentimport android.os.Buildimport android.widget.RemoteViewsimport androidx.core.app.NotificationCompatclass IncomingCallNotificationManager(private val context: Context) {private val channelId = "incoming_call_channel"private val channelName = "Call notification"private val notificationId = 1001private var remoteViews: RemoteViews? = nullprivate val notificationManager: NotificationManager =context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManagerinit {// 1.Create notification channelscreateNotificationChannel()}private fun createNotificationChannel() {if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {val channel = NotificationChannel(channelId, // Channel ID (Unique Identifier)"Call notification", // Channel Name (Visible to Users)NotificationManager.IMPORTANCE_HIGH // Importance: High priority).apply {description = "Display incoming call notification" // Channel descriptionenableLights(true) // Enable notification lightenableVibration(true) // Enable vibrationsetShowBadge(false) // Do not display badges}notificationManager.createNotificationChannel(channel)}}// 2. Display custom call notification UI stylefun showIncomingCallNotification(callerName: String,callerAvatar: Int?,isVideoCall: Boolean) {// RemoteViews are used to display custom layouts in notifications.remoteViews = RemoteViews(context.packageName, R.layout.incoming_call_notification)// Set caller nameremoteViews?.setTextViewText(R.id.tv_caller_name, callerName)// Set the call type description (video call or voice call).remoteViews?.setTextViewText(R.id.tv_call_desc, if (isVideoCall) "Video" else "Audio")// Set call type iconval callTypeIcon = if (isVideoCall) {R.drawable.ic_video_call} else {R.drawable.ic_audio_call}remoteViews?.setImageViewResource(R.id.img_call_type, callTypeIcon)// Set caller avatarremoteViews?.setImageViewResource(R.id.img_avatar, callerAvatar)// Create a notification objectval notification = NotificationCompat.Builder(context, channelId).setSmallIcon(R.drawable.ic_notification_small) // Small icons displayed in the status bar.setContent(remoteViews) // Set custom layout.setCustomContentView(remoteViews) // Standard view (when the notification bar is collapsed).setCustomBigContentView(remoteViews) // Expanded view (when the notification bar is expanded).setOngoing(false) // Continuous notification (cannot be swiped to delete).setAutoCancel(true) // Automatically cancel after tapping.setCategory(NotificationCompat.CATEGORY_CALL) // Category as call notification.setVisibility(NotificationCompat.VISIBILITY_PUBLIC) // Visible on lock screen.setTimeoutAfter(60000) // Automatically cancel after 60 seconds.build()notificationManager.notify(notificationId, notification)}}
R.layout.incoming_call_notification):<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="match_parent"android:layout_height="wrap_content"android:orientation="horizontal"android:padding="16dp"android:background="#FFFFFF"android:gravity="center_vertical"><!-- User avatar --><ImageViewandroid:id="@+id/img_avatar"android:layout_width="56dp"android:layout_height="56dp"android:layout_gravity="center_vertical"android:scaleType="centerCrop"android:src="@drawable/callview_ic_avatar"android:background="@drawable/avatar_background" /><!-- User info and description --><LinearLayoutandroid:layout_width="0dp"android:layout_height="wrap_content"android:layout_weight="1"android:layout_gravity="center_vertical"android:layout_marginStart="16dp"android:orientation="vertical"><TextViewandroid:id="@+id/tv_caller_name"android:layout_width="wrap_content"android:layout_height="wrap_content"android:textSize="18sp"android:textStyle="bold"android:textColor="#212121"android:maxLines="1"android:ellipsize="end"android:text="Incoming Call" /><LinearLayoutandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_marginTop="6dp"android:orientation="horizontal"android:gravity="center_vertical"><ImageViewandroid:id="@+id/img_call_type"android:layout_width="16dp"android:layout_height="16dp"android:src="@drawable/ic_audio_call" /><TextViewandroid:id="@+id/tv_call_desc"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_marginStart="6dp"android:textSize="14sp"android:textColor="#757575"android:text="Audio Call" /></LinearLayout></LinearLayout></LinearLayout>
class MainActivity : AppCompatActivity() {private val wakeupReceiver = PushWakeupReceiver()private var callListener: CallListener? = nulloverride fun onCreate(savedInstanceState: Bundle?) {super.onCreate(savedInstanceState)// 1.Listening to incoming call eventsobserveCallReceived()}private fun observeCallReceived() {callListener = object : CallListener() {override fun onCallReceived(callId: String, mediaType: CallMediaType, userData: String) {super.onCallReceived(callId, mediaType, userData)// 2.Display incoming call notificationshowIncomingCallNotification(mediaType)}}callListener?.let { CallStore.shared.addListener(it) }}private fun showIncomingCallNotification(mediaType: CallMediaType) {try {val callerName = CallStore.shared.observerState.activeCall.value.inviterIdval notificationManager = IncomingCallNotificationManager(this)notificationManager.showIncomingCallNotification(callerName = callerName,callerAvatar = R.drawable.callview_ic_avatar,isVideoCall = mediaType == CallMediaType.Video)} catch (e: Exception) {}}}
Parameter | Type | Description |
callId | String | Unique identifier for this call. |
mediaType | Call media type, used to specify whether to initiate an audio or video call. CallMediaType.Video: Video call.CallMediaType.Audio: Audio call. |
Field | Type | Description |
callId | String | Unique identifier for this call. |
roomId | String | Room ID for this call. |
inviterId | String | ID of the user who initiated the call. |
inviteeIds | LinkedHashSet | List of invitee user IDs. |
chatGroupId | String | Group ID for this call, used in conjunction with Chat. |
mediaType | Media type for this call. CallMediaType.Video: Video call.CallMediaType.Audio: Audio call. | |
result | Call result/direction. CallDirection.Unknown: Unknown call.CallDirection.Missed: Missed call.CallDirection.Incoming: Incoming call.CallDirection.Outgoing: Outgoing call. | |
duration | Long | Call duration. |
startTime | Long | Call start time. |


TIMPushManager.getInstance().forceUseFCMPushChannel(true);
フィードバック