视频直播源码,SystemUI 悬浮通知
视频直播源码,SystemUI 悬浮通知
简单通知创建代码
1 | <br> public void showAlarmNotification() {<br> //IMPORTANCE_HIGH 重要通知,弹出悬浮通知<br> NotificationChannel channel = new NotificationChannel("123", "测试 channel_name", NotificationManager.IMPORTANCE_HIGH);<br> //led灯<br> channel.enableLights(true);<br> //锁屏显示通知<br> channel.setLockscreenVisibility(Notification.VISIBILITY_SECRET);<br> //led灯颜色<br> channel.setLightColor(Color.BLUE);<br> <br> NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);<br> notificationManager.createNotificationChannel(channel);<br> <br> Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.baidu.com"));<br> PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, 0);<br> <br> // Get the layouts to use in the custom notification<br> RemoteViews notificationLayout = new RemoteViews(getPackageName(), R.layout.notification_layout);<br> notificationLayout.setTextViewText(R.id.text, "contentView");<br> <br> RemoteViews notificationLayoutExpanded = new RemoteViews(getPackageName(), R.layout.notification_layout_big);<br> notificationLayoutExpanded.setTextViewText(R.id.text, "bigContentView");<br> <br> // Apply the layouts to the notification<br> Notification customNotification = new NotificationCompat.Builder(this, "123")<br> .setSmallIcon(R.mipmap.ic_launcher_round)<br> .setContentTitle("imageTitle")<br> .setContentText("imageDescription")<br> .setLargeIcon(BitmapFactory.decodeResource(getResources(),R.drawable.ic_android_black_24dp))<br> .setStyle(new NotificationCompat.BigPictureStyle()<br> .bigPicture(BitmapFactory.decodeResource(getResources(),R.drawable.ic_android_black_24dp))<br> .bigLargeIcon(null))<br> .setFullScreenIntent(pendingIntent, false)<br> .build();<br> <br> notificationManager.notify(0, customNotification);<br> } |
以上就是 视频直播源码,SystemUI 悬浮通知,更多内容欢迎关注之后的文章
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· ollama系列01:轻松3步本地部署deepseek,普通电脑可用
· 25岁的心里话
· 按钮权限的设计及实现
2022-09-15 直播平台开发,附带干扰线的随机验证码
2022-09-15 直播平台搭建,javascript轮播图示例
2022-09-15 app直播源代码,html网站使用js实现记住账号密码功能
2021-09-15 短视频app开发,实现一个朴实的Canvas时钟效果
2021-09-15 直播视频app源码,自定义可点击可滑动的通用RatingBar
2021-09-15 直播源码APP的最佳扫码插件,实现自定义视图