最近在做一个基于安卓的聊天程序,但因为才上手android程序开发,还比较生疏。迅速切入问题:
服务器端已经完成,当客户端收到服务器端转发的消息以后如何能弹出某一个提示框提示某一个好友有新消息,比如弹出这个好友的聊天对话框或者像QQ一样出现闪动的情况?谢谢!
服务器端已经完成,当客户端收到服务器端转发的消息以后如何能弹出某一个提示框提示某一个好友有新消息,比如弹出这个好友的聊天对话框或者像QQ一样出现闪动的情况?谢谢!
解决方案 »
- 新浪微博Android版认证界面问题
- android 中 View 的层次问题
- 求助:Android中怎样截获系统触屏或按键输入事件?
- android自带浏览器,播放网页视频MV时,按home键退出到桌面,再进去浏览器后,黑屏
- Android 线程 死机
- 想学习Android,请教有什么菜鸟看的基础入门的书或资料
- android.database.sqlite.SQLiteDiskIOException: disk I/O error的异常问题
- adapter.notifyDataSetChanged执行的时候没有执行getview,adapter内容改变了
- 在线跪等!!求大神帮忙看看!!!!
- 求问一下啊。怎么才能实现一个可以涂鸦的相册。
- GPS定位+MapView显示定位信息问题
- 关于selector的问题
NotificationManager notificationManager = (NotificationManager) getSystemService(android.content.Context.NOTIFICATION_SERVICE);
// 定义Notification的各种属性
Notification notification = new Notification(R.drawable.icon,
getString(R.string.app_name), System.currentTimeMillis());
notification.flags |= Notification.FLAG_ONGOING_EVENT; // 将此通知放到通知栏的"Ongoing"即"正在运行"组中
notification.flags |= Notification.FLAG_NO_CLEAR; // 表明在点击了通知栏中的"清除通知"后,此通知不清除,经常与FLAG_ONGOING_EVENT一起使用
notification.flags |= Notification.FLAG_SHOW_LIGHTS;
notification.defaults = Notification.DEFAULT_LIGHTS;
notification.ledARGB = Color.BLUE;
notification.ledOnMS = 5000;
// 设置通知的事件消息
CharSequence contentTitle = getString(R.string.app_name); // 通知栏标题
CharSequence contentText = audiocontent.getText(); // 通知栏内容
Intent notificationIntent = new Intent(this, MainActivity.class); // 点击该通知后要跳转的Activity
PendingIntent contentItent = PendingIntent.getActivity(this, 0,
notificationIntent, 0);
notification.setLatestEventInfo(this, contentTitle, contentText,
contentItent); // 把Notification传递给NotificationManager
notificationManager.notify(0, notification);
android.permission.SYSTEM_ALERT_WINDOW
也可以直接启动窗口样式activity