`

notification功能实现

 
阅读更多
NotificationManager manager = (NotificationManager) this.getSystemService(Context.NOTIFICATION_SERVICE);
		Notification notification = new Notification();
		notification.icon = R.drawable.icon;
		notification.tickerText = "我在这里";
//		notification.defaults = Notification.DEFAULT_SOUND;
//		notification.audioStreamType = android.media.AudioManager.ADJUST_LOWER;
		
		Intent intent = new Intent(this, NotificationActivity.class);
		
		PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_ONE_SHOT);
		notification.setLatestEventInfo(this, "短信通知", "亲爱的,晚上8点老地方见哦~", pendingIntent);
		manager.notify(R.drawable.icon, notification);

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics