`

android 2.3 notifaction 使用

 
阅读更多
	NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
		
		// Notification
		Notification notification = new Notification();
		notification.icon = R.drawable.ic_launcher; // 设置通知的图标
		notification.defaults |= Notification.DEFAULT_SOUND;
//		notification.defaults |= Notification.DEFAULT_VIBRATE;
		notification.flags |= Notification.FLAG_AUTO_CANCEL;
		notification.when = System.currentTimeMillis();
		
		 Intent intent = new Intent(context,
		 MainActivity.class);
//		 intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
//		 intent.setFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
//		 intent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
//		 intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
//		 intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
		//
		 PendingIntent contentIntent = PendingIntent.getActivity(context, 0,
		 intent, PendingIntent.FLAG_UPDATE_CURRENT);
		//
		 notification.setLatestEventInfo(context, "有新消息", message.getContent(),
		 contentIntent);
		 
		 notificationManager.notify(message.getTime().hashCode(), notification);

 

分享到:
评论

相关推荐

    android 2.3 源代码

    android 2.3 源代码 android 2.3 源代码 android 2.3 源代码

    flash for android2.3

    标题中的“Flash for Android2.3”指的是Adobe Flash Player在Android 2.3 Gingerbread操作系统上的版本。在本文中,我们将深入探讨Flash Player的历史、它在Android设备上的应用以及与Android 2.3系统的关系。 ...

    Android2.3应用开发实战源代码

    《Android2.3应用开发实战源代码》是林城撰写的一本书,主要针对的是Android 2.3(Gingerbread)版本的应用程序开发。这本书通过实际案例的方式,深入浅出地介绍了如何在Android 2.3平台上构建和优化应用程序。在源...

    android 2.3 sdk android-2.3-sdk

    Android 2.3 SDK,又称为Gingerbread(姜饼),是Google针对其移动操作系统Android发布的一个重要版本。这个SDK(软件开发工具包)为开发者提供了构建、测试和调试针对Android 2.3系统应用所需的工具和技术文档。...

    android2.3源码解读—stagefright框架

    《Android 2.3源码解读—Stagefright框架》 Android系统中,多媒体处理是一个至关重要的部分。在Android 2.3版本之前,OpenCORE是主要的多媒体框架,但其复杂的架构和维护成本促使Google引入了更为简洁的Stage...

    android2.3 launcher分析三

    【Android 2.3 Launcher 分析】 Android 2.3 的 Launcher 是用户界面的核心部分,它作为设备的主要入口,提供用户访问应用程序、小部件和设置的界面。在深入分析之前,我们先了解一下 Launcher 的基本架构。 **...

    android2.3下s3c6410串口开发

    android2.3下三星6410串口开发总结,uboot裸机代码,android下jin层串口初始化、读、写函数

    android 2.3升级方法

    ### Android 2.3 升级方法详解 #### 前言 随着移动技术的不断发展,用户对于手机操作系统的...虽然现在Android系统已经发展到了更高的版本,但对于一些老旧设备而言,升级到Android 2.3依然能够带来更好的使用体验。

    Ubuntu平台下Android2.3源码下载编译全过程

    在Ubuntu平台上编译Android 2.3源码是一项复杂的过程,需要遵循一系列步骤。首先,确保你的系统满足必要的要求,即运行Ubuntu 10.04或更新版本,并且是64位系统。同时,安装Java Development Kit (JDK) 1.6或更高...

    Android 2.3 源代码

    Android 2.3支持多种网络连接方式,开发者可以利用这些底层库构建网络应用,如使用HttpURLConnection进行HTTP请求,或者通过WifiManager管理WiFi连接。 三、其他(other) "other"目录通常包含一些不直接归类于特定...

    Android2.3应用开发实战

    书中完整介绍了 android2.3版的功能,相关范例程序所涉及的主题范围广泛,且有清楚的解说。  《android 2.3应用开发实战》包括 android介绍、开发环境、应用开发平台、活动程序 activity、意图方法intent、widget、...

    Android2.3蓝牙串口程序

    Android2.3通过蓝牙串口接收数据,并解析。

    Android2.3 帮助文档

    在"Android2.3 帮助文档.chm"中,读者可以找到关于这些特性和功能的详细解释,包括如何使用、如何开发和如何优化。这个文档通常会包含API参考、开发者指南、用户手册等内容,对于想要深入了解Android 2.3的开发者和...

    Root Explorer(Android 2.3以下使用)

    支持Android2.3 版本以下使用的Root Explorer

    csdn无名游戏源码android2.3

    【标题】"csdn无名游戏源码android2.3" 涉及的是一个在CSDN上分享的游戏源代码,适用于Android 2.3操作系统。这通常意味着这是一个相对较为早期的Android开发项目,因为Android 2.3(Gingerbread)是在2010年发布的...

    android2.3 仿 4.0 launcher

    总的来说,【android2.3 仿 4.0 launcher】是一个旨在提升老版本Android用户体验的开源项目。通过这个启动器,用户可以在他们的Android 2.3设备上享受更现代的界面和功能。同时,对于开发者而言,这也是一个学习如何...

    android 2.3 源码 src

    1. Proguard:Android 2.3中使用的代码混淆工具,用于保护代码安全,减小APK大小。 2. JDiff:用于生成API差异报告,帮助开发者了解新旧版本之间的变化。 3. Vogar:Android的单元测试框架,确保源码的质量和稳定...

    Android 2.3应用开发实战 上部分代码

    在Android 2.3应用开发实战中,开发者将深入学习如何构建高效且用户友好的应用程序。这个阶段的Android系统版本,也称为Gingerbread,是Android平台的一个重要里程碑,为开发者提供了更多的特性和优化,旨在提升用户...

Global site tag (gtag.js) - Google Analytics