如果target到API 21,有一些注意的事项,以下是目前我发现的两个问题
1. Service must be explitict,从Lollipop开始,service必须显性声明,解决方案:http://blog.android-develop.com/2014/10/android-l-api-21-javalangillegalargumen.html
源代码参考
`sdk/sources/android-21/android/app/ContextImpl.java`

 private void validateServiceIntent(Intent service) {
if (service.getComponent() == null && service.getPackage() == null) {
if (getApplicationInfo().targetSdkVersion >= Build.VERSION_CODES.LOLLIPOP) {
IllegalArgumentException ex = new IllegalArgumentException(
"Service Intent must be explicit: " + service);
throw ex;
} else {
Log.w(TAG, "Implicit intents with startService are not safe: " + service
+ " " + Debug.getCallers(2, 3));
}
}
}

2. Material Design 按钮文字默认大写,相关链接:https://code.google.com/p/android-developer-preview/issues/detail?id=487,奇怪吧,看看源代码就知道

    <style name="TextAppearance.Material.Button">
<item name="textSize">@dimen/text_size_button_material</item>
<item name="fontFamily">@string/font_family_button_material</item>
<item name="textAllCaps">true</item>
<item name="textColor">?attr/textColorPrimary</item>
</style>

3. 补充一点, 谢谢@King Sing提供。 JobScheduler 是可以通过System serviceContext.getSystemService(Context.JOB_SCHEDULER_SERVICE)来获得的,它不依赖于implicit service或者是explicit service,但explicit service是可以与JobScheduler交互,参考sample,https://github.com/googlesamples/-JobScheduler。 在app中声明的explicit service,用电是在app头上,所以使用者看到的结果是android os 耗电不会很高,取而代之是各种app在耗电list裹。

4. Material Design Action Bar 默认是有shadow的,是因为新的elevation API, 所以你想去除它,要买在action bar style 的xml中,定义elevation 属性为0,要么

 getActionBar().setElevation(0)

Service must be explitict android 5.0问题的更多相关文章

  1. 《Thinking in Android 9.0 系统开发源码钻研录》

    最近打算把个人站点的博客文章同步到"博客园"! Thinking in Android -- "系统启动" [启动阶段] [相关文章] 状态 源码版本 init ...

  2. 如何解决Android 5.0中出现的警告:Service Intent must be explicit

    有些时候我们使用Service的时需要采用隐私启动的方式,但是Android 5.0一出来后,其中有个特性就是Service Intent  must be explitict,也就是说从Lollip ...

  3. 解决Android 5.0中出现的警告:Service Intent must be explicit

    extends:http://www.eoeandroid.com/thread-568853-1-1.html 本帖最后由 469874851 于 2015-3-11 18:15 编辑 有些时候我们 ...

  4. 我的Android进阶之旅------>如何解决Android 5.0中出现的警告: Service Intent must be explicit:

    我的Android进阶之旅-->如何解决Android 5.0中出现的警告: java.lang.IllegalArgumentException: Service Intent must be ...

  5. 我的Android进阶之旅------&gt;怎样解决Android 5.0中出现的警告: Service Intent must be explicit:

    我的Android进阶之旅-->怎样解决Android 5.0中出现的警告: java.lang.IllegalArgumentException: Service Intent must be ...

  6. 如何解决Android 5.0以上出现的警告:Service Intent must be expli

    有些时候我们使用Service的时需要采用隐私启动的方式,但是Android 5.0一出来后,其中有个特性就是Service Intent  must be explitict,也就是说从Lollip ...

  7. [Android分享] 如何解决Android 5.0中出现的警告:Service Intent must be explicit

    Android 5.0程序运行报Service Intent must be explicit错误,原因是5.0的service必须显式调用 改成 Intent intent = new Intent ...

  8. Android(4.0.3+): Service, AsyncTask, 定时任务和UI通信

    Service使用AlarmManager实现后台定时任务 在Android 4.0.3版本中, 使用AlarmManager实现后台定时任务是比较好的方案, 其实现机制, 是利用Service的 o ...

  9. Android 8.0 启动后台service 出错 IllegalStateException: Not allowed to start service Intent

    错误原因: Android 8.0 不再允许后台service直接通过startService方式去启动, 具体行为变更如下: 如果针对 Android 8.0 的应用尝试在不允许其创建后台服务的情况 ...

随机推荐

  1. npm link 的用法

    npm link 的用法 先到对应的自定义包下执行 npm link 会读取对应的 packagejson 中的名称 然后到对应的目录下执行 npm link your/own/npm/name 就会 ...

  2. gcc 编译c++文件

    #include <stdio.h> //将类定义在命名空间中 namespace Diy{ class Student{ public: char *name; int age; flo ...

  3. ex2

    #include <stdio.h> int main() { int days; printf("输入一个整数: \n"); scanf("%d" ...

  4. Ubuntu 16.04 一系列软件安装命令,包括QQ、搜狗、Chrome、vlc、网易云音乐安装方法

    1 简介 Ubuntu 16.04安装完后,还需要做一些配置才能愉快的使用,包括添加软件源.安装搜狗输入法.Chrome浏览器.网易云音乐.配置快捷键.安装git等等,下面就跟着我来配置吧,just ...

  5. oracle 根据身份证号计算出生日期

      1.情景展示 如何根据身份证号推算出出生日期? 2.解决方案 --根据身份证号计算出生日期 SELECT DECODE(LENGTH(ID_CARD), 18, SUBSTR(ID_CARD, 7 ...

  6. 理解Docker :Docker 网络

    本系列文章将介绍 Docker的相关知识: (1)Docker 安装及基本用法 (2)Docker 镜像 (3)Docker 容器的隔离性 - 使用 Linux namespace 隔离容器的运行环境 ...

  7. test软件工程第三次作业

    零.前言 本次作业要求个人编写程序,截止日期2019年9月25日23:00. 请先阅读<构建之法>第一章至第三章的内容,并在下方作业里体现出阅读后的成果.特别是第2章中的效能分析及个人软件 ...

  8. SEAndroid

    SEAndroid安全机制所要保护的对象是系统中的资源,这些资源分布在各个子系统中,例如我们经常接触的文件就是分布文件子系统中的. 实际上,系统中需要保护的资源非常多,除了前面说的文件之外,还有进程. ...

  9. linux 实时监控网速脚本(转)

    #!/bin/bash ethn=$ while true do RX_pre=$(cat /proc/net/dev | grep $ethn | sed 's/:/ /g' | awk '{pri ...

  10. C#实体类对应SQL数据库的自增长ID怎么设置?

    /// <summary> /// 自增长ID /// </summary> [DatabaseGenerated(DatabaseGeneratedOption.Identi ...