摘要: 关于PendingIntent传值的问题,自己又发现了一些新的实现方法现在我有这么个需求:服务器不停的向客户端push消息,客户端在开机时或客户端启动时会开启一个service来接收服务器push下来的消息,客户端接收消息后向用户发送通知提示用户有新的消息,并且消息中带有参数。用户通过点击通知可以启动主程序,并且接收到相应的参数。注:如果用户不是点击通知,而是通过其他方式进入程序则不能获取到参数。从上述需求可以onNewIntent已经不满足要求了。因为onNewIntent的启动是在startActivity执行的时候才被触发,也就是主程序必须已经启动了。主程序没有启动,点击通知启动主程序, 阅读全文
posted @ 2012-02-13 13:52 烟卷儿 阅读(3101) 评论(0) 推荐(0) 编辑
摘要: 在IntentActivity中重写下列方法:onCreate onStart onRestart onResume onPause onStop onDestroy onNewIntent一、其他应用发Intent,执行下列方法:I/@@@philn(12410): onCreateI/@@@philn(12410): onStartI/@@@philn(12410): onResume发Intent的方法:Uri uri = Uri.parse("philn://blog.163.com");Intent it = new Intent(Intent.ACTION_VI 阅读全文
posted @ 2012-02-10 13:23 烟卷儿 阅读(99713) 评论(1) 推荐(9) 编辑
摘要: Android支持Toast和NotificationManager两种通知方式,前者相当于一个定时关闭的对话框,后者是在状态栏上显示一条消息。Toast和Notification都可以随时取消。ToastA toast is a view containing a quick little message for the user. The toast class helps you create and show those. Toast的使用很简单:Toast.makeText(this, "Service destroyed…", Toast.LENGTH_LONG 阅读全文
posted @ 2012-02-09 14:32 烟卷儿 阅读(29108) 评论(0) 推荐(0) 编辑