摘要: pendingIntent字面意义:等待的,未决定的Intent。 pendingIntent对象,使用方法类的静态方法 : getActivity(Context, int, Intent, int) >跳转到一个activity组件、 getBroadcast(Context, int, Int 阅读全文
posted @ 2017-04-12 15:08 brave-sailor 阅读(476) 评论(0) 推荐(0)
摘要: 情况简述 在开发Android app的过程中,遇到这样一个需求:app中启动一个Service,该Service在独立进程中运行,与服务器保持长连接,将服务器推送过来的消息在通知栏中显示,并设置点击动作,点击后跳转到app中对应的Activity。目前遇到的问题是Service以独立进程运行,在收 阅读全文
posted @ 2017-04-12 15:06 brave-sailor 阅读(3059) 评论(0) 推荐(1)
摘要: 版权声明:本文为博主原创文章,未经博主允许不得转载。 //当前应用是否处于前台 private boolean isForeground(Context context) { if (context != null) { ActivityManager activityManager = (ActivityManager) context... 阅读全文
posted @ 2017-04-12 12:05 brave-sailor 阅读(8132) 评论(0) 推荐(0)
摘要: 本次给大家分析的是Android中Alarm的机制所用源码为最新的Android4.4.4。首先简单介绍如何使用Alarm并给出其工作原理,接着分析Alarm和Timer以及Handler在完成定时任务上的差别,最后分析Alarm机制的源码。 什么是Alarm Alarm是android提供的用于完 阅读全文
posted @ 2017-04-12 11:45 brave-sailor 阅读(663) 评论(0) 推荐(0)