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);


你可能感兴趣的:(android-发送状态栏通知)