如果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. P1005 矩阵取数

    题目链接 看完题可能第一时间并没有清晰的思路.让我们一步一步的来考虑这道题目. 题目中描述操作为每次从所有的行中选取,这样做有些麻烦.仔细思考一下可以发现行与行之间互不干涉,所以我们可以对每行操作到底 ...

  2. GoCN每日新闻(2019-10-29)

    GoCN每日新闻(2019-10-29) GoCN每日新闻(2019-10-29)   1. Go 的发展传奇 https://spf13.com/presentation/the-legacy-of ...

  3. Spring和MyBatis整合(注解版)

    1.导入所需要的依赖 <!--MyBatis和Spring的整合包 由MyBatis提供--> <dependency> <groupId>org.mybatis& ...

  4. 冰多多团队Beta阶段发布说明

    Bingduoduo 语音Coding(Beta):项目Github地址 Beta版本新功能介绍 在beta阶段我们很好地将alpha阶段已经设计好的编辑器和shell整合了起来,推出了一个完整的ID ...

  5. Google BERT应用之《红楼梦》对话人物提取

    Google BERT应用之<红楼梦>对话人物提取 https://www.jiqizhixin.com/articles/2019-01-24-19

  6. malloc分配到一块内存,读写操作时却发生segmentation falt的奇怪问题。

    期初现象:malloc一块内存,读写操作时发生segmentation falt.一般来讲malloc倘若失败应该抛出异常,所以malloc返回一个指针后,这个指针应该都是可用的,况且是进行读操作. ...

  7. tp的增删改查的结果判断?

    参考: https://blog.csdn.net/qq_27930635/article/details/78853908 总之, 要用 全等 来判断, = = = 注意, 不要再用 mysql_a ...

  8. 公司-IT-Yahoo:百科

    ylbtech-公司-IT-Yahoo:百科 雅虎(英文名称:Yahoo!,NASDAQ:YHOO)是美国著名的互联网门户网站,也是20世纪末互联网奇迹的创造者之一.其服务包括搜索引擎.电邮.新闻等, ...

  9. 003-Python3-基础语法-运行方式、代码基础要求、运算符[算数运算符、比较运算符、赋值运算符、位运算符、逻辑运算符、成员运算符、身份运算符]、运算符优先级

    一.基础语法 参看地址:https://www.runoob.com/python3/python3-tutorial.html 1.1.运行方式 1.文件方式 编写一个hello.py文件, pri ...

  10. HDFS API 测试用例

    增加依赖 <!--hadoop--> <dependency> <groupId>org.apache.hadoop</groupId> <art ...