欢迎访问悦橙教程(wld5.com),关注java教程。悦橙教程  java问答|  每日更新
页面导航 : > > > 文章正文

android-发送状态栏通知,android-状态栏通知

来源: javaer 分享于  点击 1785 次 点评:90

android-发送状态栏通知,android-状态栏通知


String tickerText = shorttitleText.getText().toString();//通知显示的标题
    String title = titleText.getText().toString();//通知的标题
    String content = contentText.getText().toString();//通知的内容
    int icon = android.R.drawable.stat_notify_chat;//通知的图标
    Notification notification = new Notification(icon, tickerText, System.currentTimeMillis());
    Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:194949494"));//通知的点击事件
    PendingIntent pendingIntent = PendingIntent.getActivity(this, 10, intent, 0);
    notification.setLatestEventInfo(this, title, content, pendingIntent);
    notification.defaults = Notification.DEFAULT_SOUND;
    notification.flags = Notification.FLAG_AUTO_CANCEL;
    
    NotificationManager manager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
    manager.notify(100, notification);


相关文章

    暂无相关文章

用户点评