Full-Screen Incoming Calls Notification - Only Shown Small Dialog
davidnardya opened this issue · 1 comments
Description
I am trying to change the incoming calls notification to present a full screen designed view and not a simple notification at the top of the screen. I understand Android OS now blocks services from starting the activity, and when I tried to use full screen intent there was no change to the size of the notification. I also tried to create a custom view for the notification but still no change.
Steps to Reproduce
- Install demp app
- Get an incoming call
Code
Here's the notification creation code:
NotificationCompat.Builder(
applicationContext, channelId
)
.setSmallIcon(R.drawable.centerya_logo_just_c_1024_1024)
.setContentTitle(applicationContext.applicationInfo.name)
.setContentText(text)
.setContent(contentView)
.setCategory(Notification.CATEGORY_CALL)
.setExtras(extras)
.setAutoCancel(true)
.setVisibility(NotificationCompat.VISIBILITY_PUBLIC)
.setPriority(NotificationCompat.PRIORITY_MAX)
.addAction(R.drawable.baseline_close_24,"Decline", piRejectIntent)
.addAction(R.drawable.baseline_check_24,"Answer", piAcceptIntent)
.setFullScreenIntent(pendingIntent, true)
Here's the custom view:
<?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="match_parent"
android:orientation="vertical"
android:gravity="center"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
<ImageView
android:id="@+id/caller_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/ic_launcher"
android:layout_weight="1"
android:contentDescription="caller_image" />
<TextView
android:id="@+id/caller_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:text="Caller"
android:layout_weight="1"
android:textSize="20sp"
android:textColor="@color/black"
/>
</LinearLayout>
Here are the manifest permissions:
<uses-feature
android:name="android.hardware.telephony"
android:required="true" />
<uses-permission android:name="android.permission.MANAGE_OWN_CALLS" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_PHONE_CALL" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
<uses-permission android:name="android.permission.USE_FULL_SCREEN_INTENT" />
And the services in the manifest:
<service
android:name=".services.IncomingCallNotificationService"
android:enabled="true"
android:exported="false" >
<intent-filter>
<action android:name="ACTION_ACCEPT" />
<action android:name="ACTION_REJECT" />
</intent-filter>
</service>
<service
android:name=".services.VoiceConnectionService"
android:exported="false"
android:label="@string/app_name"
android:permission="android.permission.BIND_TELECOM_CONNECTION_SERVICE" >
<intent-filter>
<action android:name="android.telecom.ConnectionService" />
</intent-filter>
</service>
<service
android:name=".services.VoiceFirebaseMessagingService"
android:exported="false"
android:foregroundServiceType="phoneCall"
android:stopWithTask="false" >
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
Please advise
Expected Behavior
Get a full screen view (matching the entire phone's screen)
Actual Behavior
Getting a small notification dialog at the top of the screen
Reproduces How Often
Always
Twilio Call SID(s)
Every call, but for example
CAc8270d14e35c4c29507a963baa9bcaa2
Versions
All relevant version information for the issue.
Voice Android SDK
com.twilio:voice-android:6.4.0
OS Version
Android 12
Device Model
OnePlus 7 PRo
@davidnardya This isn't an SDK question, this is a more general Android development question... That being said, I don't believe you can make a full screen notification. At best, you can make a notification that when the user taps on it, it launches a full screen activity.
With the latest Android SDK (34) you can make full screen notifications more info can be found here..
https://developer.android.com/reference/android/app/NotificationManager#canUseFullScreenIntent()
https://developer.android.com/develop/ui/views/notifications
I would recommend modifying our Quickstart where we put up notifications and adapt it to fit your needs