使用系统资源的引用总结以及收到短信后给一个notification提示
1.代码使用android.R.id xml引用 android:id/tabhost 颜色引用 android.R.color.transparent
调用动画
android.R.anim
2.
mNotificationManager = (NotificationManager) arg0.getSystemService
(Context.NOTIFICATION_SERVICE);
Uri uri = Uri.parse("content://sms/inbox");
PendingIntent contentIntent = PendingIntent.getActivity(arg0, 0, new Intent(Intent.ACTION_VIEW, uri), Intent.FLAG_ACTIVITY_NEW_TASK);
String tickerText = arg0.getString(R.string.newmsg, msgs[i].getMessageBody().toString());
Notification notif = new Notification(R.drawable.icon, tickerText, System.currentTimeMillis());
notif.setLatestEventInfo(arg0, msgs[i].getOriginatingAddress(), msgs[i].getMessageBody().toString(), contentIntent);
notif.vibrate = new long[] { 100, 250, 100, 500 };
mNotificationManager.notify(R.string.recv_msg_notif_id, notif);
上述是不能实现的
应该如此修改
Intent notificationIntent = new Intent(Intent.ACTION_MAIN);
notificationIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP);
notificationIntent.setType("vnd.android-dir/mms-sms");
更多相关文章
- Delphi XE5 android openurl
- android 从横屏到竖屏状态出现黑屏
- Android(安卓)之WebView
- android兼容2.2及以前版本的退出方法
- Android(安卓)(DiskLruCache)硬盘缓存代码实现
- Android获取状态栏的高度
- Android(安卓)init.rc文件解析过程详解(二)
- Android(安卓)Apk加固(安全专项)
- Android系统源代码情景分析:基础知识