---
title: "Android开发片段–Notification"
author: "04023129"
date: "2011-12-06T09:01:07Z"
tags: []
categories: ["移动开发"]
slug: "android-notification"
draft: false
lastmod: "2011-12-06T09:01:07Z"
id: 1292908
url: "https://zzh.iteye.com/blog/1292908"
---

```
NotificationManager mn =( NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE);
		notification = new Notification(iconImage,statusBarText, System.currentTimeMillis());
		notification.defaults |= Notification.DEFAULT_LIGHTS;
		notification.sound = Uri.parse("android.resource://" + context.getPackageName()
				+ "/" + R.raw.message);
        PendingIntent contentIntent=PendingIntent.getActivity(context,
                0, null, 0);
        notification.setLatestEventInfo(context,title, content, contentIntent);
        mn.notify(1, notification);
```