uniapp caller ID floating window plug-in (support lock screen call) Ba-CallerID

Introduction ( download address )

Ba-CallerID is a caller ID floating window plug-in plug-in.

  • Support display and hide
  • Support lock screen caller ID
  • Support custom position display (top, middle, bottom)
  • Support dragging (this version does not support, you can add it if necessary)
  • Support application and judge floating window permissions

screenshot display

insert image description here

Instructions

scriptIntroduce components in

	const callerID = uni.requireNativePlugin('Ba-CallerID')

Called in script(example reference, you can modify it according to your own business and calling method)

        methods: {
    
    
			showFW(gravity) {
    
     //显示
				callerID.show({
    
    
						gravity: gravity, //显示位置:0中间 1上 2下
						name: "三杯五岳",
						content: "生活的梦,永远不止如此!",
						call: "接听电话",
						uncall: "拒绝电话",
						empty: "无记录",
						avatar: "https://test.jpg",
						totalHint: "详情记录(6)",
						tel: "010-0100-7530",
						list: [{
    
    
							iconText: "张",
							title1: "张三",
							title2: "河北某宝公司",
							date: "2023-4-19",
							time: "22:10:21",
							iconColor: "#A71F21",
							title1Color: "#6B646B",
							title2Color: "#333333",
						}, {
    
    
							iconText: "李",
							title1: "李四",
							title2: "深圳某东有限公司",
							date: "2023-4-19",
							time: "22:10:21",
							iconColor: "#00A71F",
							title1Color: "#00646B",
							title2Color: "#003333",
						}]
					},
					(res) => {
    
    
						console.log(res);
						uni.showToast({
    
    
							title: res.msg,
							icon: "none",
							duration: 3000
						})
					});
			},
			hideFW() {
    
     //隐藏
				callerID.hide(
					(res) => {
    
    
						console.log(res);
						uni.showToast({
    
    
							title: res.msg,
							icon: "none",
							duration: 3000
						})
					});
			},
			permissionFW() {
    
     //申请悬浮窗权限
				callerID.permission(
					(res) => {
    
    
						console.log(res);
						uni.showToast({
    
    
							title: res.msg,
							icon: "none",
							duration: 3000
						})
					});
			},
			goPermissionFW() {
    
     //跳转到悬浮窗权限页面
				callerID.goPermission(
					(res) => {
    
    
						console.log(res);
						uni.showToast({
    
    
							title: res.msg,
							icon: "none",
							duration: 3000
						})
					});
			},
			isPermissionFW() {
    
     //是否申请悬浮窗权限
				callerID.isPermission(
					(res) => {
    
    
						console.log(res);
						let msg = res.msg;
						if (res.data) {
    
    
							msg = "isPermission:" + res.data.isPermission;
						}
						uni.showToast({
    
    
							title: msg,
							icon: "none",
							duration: 3000
						})
					});
			},
		}

Click event listener

Set the listener in the onLaunch event of the application lifecycle app.vue:

        onLaunch: function() {
    
    
			var globalEvent = uni.requireNativePlugin('globalEvent');
			globalEvent.addEventListener('baCallerIdEvent', function(e) {
    
    
				console.log('baCallerIdEvent:' + JSON.stringify(e));
				//处理点击事件
			});
		},
		onShow: function() {
    
    
		},
		onHide: function() {
    
    
		}

Click event parameters

attribute name illustrate
action Event type, such as: onClick
tag Event name: answer call call, hang up call uncall

Example:

{
    
    "tag":"uncall","action":"onClick"}

api list

method name illustrate
show show
hide hide
permission Apply for floating window permission
goPermission Jump to the floating window permission page
isPermission Whether to apply for floating window permission

Series plug-ins

Image picker plugin Ba-MediaPicker ( documentation )

Image editing plugin Ba-ImageEditor ( documentation )

File picker plugin Ba-FilePicker ( documentation )

Application message notification plug-in (multiple styles, new support for resident notification mode) Ba-Notify ( documentation )

Custom notification (headphone power) plug-in Ba-NotifyEarphone ( documentation )

Apply the unread badge plugin Ba-Shortcut-Badge ( documentation )

Apply the plug-in Ba-Autoboot ( documentation )

Scan code native plug-in (millisecond level, support multi-code) Ba-Scanner-G ( documentation )

Native plug-in for scanning code - new (can customize the interface version arbitrarily; support continuous scanning code; support setting scanning code format) Ba-Scanner ( documentation )

Dynamically modify the status bar, navigation bar background color, font color plug-in Ba-AppBar ( documentation )

Native sqlite local database management Ba-Sqlite ( documentation )

Android keep-alive plug-in (using a variety of mainstream technologies) Ba-KeepAlive ( documentation )

Android Keep Alive Suite (General, Permanent Notification, Battery Optimization, Self-Startup Management, Background Operation, etc.) ( Documentation )

Android shortcut (desktop long press app icon) Ba-Shortcut ( documentation )

Custom image watermark (anywhere) Ba-Watermark ( documentation )

The closest image compression plug-in to WeChat is Ba-ImageCompressor ( documentation )

Video compression, video editing plug-in Ba-VideoCompressor ( documentation )

Dynamically switch application icons and names (such as New Year, National Day, etc.) Ba-ChangeIcon ( documentation )

Native Toast pop-up prompt (through all interfaces, through native; custom colors, icons) Ba-Toast ( documentation )

Image Graffiti, Brush Ba-ImagePaint ( documentation )

pdf reading (gesture zoom, display page number) Ba-Pdf ( documentation )

Sound reminder, vibration reminder, voice broadcast Ba-Beep ( documentation )

Websocket native service (automatic reconnection, heartbeat detection) Ba-Websocket ( documentation )

SMS monitoring (verification code) Ba-Sms ( documentation )

Smart Install (Automatic Upgrade) Ba-SmartUpgrade ( documentation )

Monitor system broadcast, custom broadcast Ba-Broadcast ( documentation )

Listen to notification bar messages (support whitelist, blacklist, filter) Ba-NotifyListener ( documentation )

Global graying, mourning graying (dynamic, support nvue, vue at the same time) Ba-Gray ( documentation )

Get Device Unique Identifier (OAID, AAID, IMEI, etc.) Ba-IdCode ( documentation )

Real-time positioning (system, background operation, support screen) plug-in Ba-Location ( documentation )

Real-time positioning (AutoNavi, running in the background, supporting screen information, coordinate conversion, distance calculation) Ba-LocationAMap ( documentation )

Widgets, Desktop Widgets, Widgets Ba-AppWidget ( documentation )

Widgets, widgets, widgets (calendar, time) Ba-AwCalendarS ( documentation )

Picture-in-picture floating window (video) Ba-VideoPip ( documentation )

Floating window (displayed on top of other applications) Ba-FloatWindow ( documentation )

Floating window (in-app, no authorization required) Ba-FloatWindow2 ( documentation )

Floating window (floating ball, dynamic menu, display on top of other applications) Ba-FloatBall ( documentation )

Added to "Open with other apps" for file delivery, sharing, etc. Ba-ShareReceive ( documentation )

Get Map Data (Geocode, Geocoding, Anti-Geocoding) Ba-AMapData ( documentation )

Guess you like

Origin blog.csdn.net/u013164293/article/details/130299287