调试 webview 通知Notification

mAgentWeb.getWebCreator().getWebView().setWebContentsDebuggingEnabled(true);
edge://inspect/#devices

通知

Intent intent = new Intent(MainActivity.this,Main2Activity.class);
                PendingIntent pendingIntent = PendingIntent.getActivity(MainActivity.this,0,intent,0);
                NotificationManager manager = (NotificationManager)getSystemService(NOTIFICATION_SERVICE);
                Notification notification = new NotificationCompat.Builder(MainActivity.this)//此处会有中间一道线,并不影响运行,这是android系统版本的问题
                        .setContentTitle("标题")  //显示通知的标题
                        .setContentText("这里展示的是通知内容~")//显示消息通知的内容
                        .setWhen(System.currentTimeMillis()+100)//显示通知的具体时间
                        .setSmallIcon(R.mipmap.ic_launcher)//这里设置显示的是手机顶部系统通知的应用图标
                        .setLargeIcon(BitmapFactory.decodeResource(getResources(), R.mipmap.ic_launcher))//这里设置显示的是下拉通知栏后显示的系统图标
                        .setContentIntent(pendingIntent)
                        //.setAutoCancel(true)//可以在此使用此方法,点击通知后,通知内容自动取消,也可以在NotificationActivity.java中设置方法取消显示通知内容
//                        .setVibrate(new long[] {0,1000,1000,1000})//设置发出通知后震动一秒,停止一秒后再震动一秒,需要在manifest.xml中设置权限
                        .build();
                manager.notify(1,notification);

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值