当前位置: 首页 > news >正文

网站改版建设关键词自然排名优化

网站改版建设,关键词自然排名优化,长沙网站设计我选刻,在手机上编写安卓app做一个应用#xff0c;需要强制关闭进程。 可以使用ActivityManager的killBackgroundProcesses方法#xff0c;需要权限android.permission.KILL_BACKGROUND_PROCESSES。但使用此方法杀死进程后#xff0c;进程会重启。源码中解释如下#xff1a; Have the system immediat… 做一个应用需要强制关闭进程。 可以使用ActivityManager的killBackgroundProcesses方法需要权限android.permission.KILL_BACKGROUND_PROCESSES。但使用此方法杀死进程后进程会重启。源码中解释如下 Have the system immediately kill all background processes associated with the given package.  This is the same as the kernel killing those processes to reclaim memory; the system will take care of restarting these processes in the future as needed. 为了强制关闭进程希望使用ActivityManager的另外一个方法forceStopPackage。源码中解释如下 Have the system perform a force stop of everything associated with the given application package.  All processes that share its uid will be killed, all services it has running stopped, all activities removed, etc.  In addition, a {link Intent#ACTION_PACKAGE_RESTARTED} broadcast will be sent, so that any of its registered alarms can be stopped, notifications removed, etc. 使用这个方法有两点需要注意 - 此方法是hide的方法 解决方案是使用java的反射机制完成调用代码如下 [java]  view plain copy print ? ActivityManager mActivityManager  (ActivityManager) mContext.getSystemService(Context.ACTIVITY_SERVICE);   Method method  Class.forName(android.app.ActivityManager).getMethod(forceStopPackage, String.class);   method.invoke(mActivityManager, packageName);  //packageName是需要强制停止的应用程序包名   - 此方法需要权限android.permission.FORCE_STOP_PACKAGES 下面着手分析这个权限。 这个权限在frameworks/base/core/res/AndroidManifest.xml文件中声明如下: [java]  view plain copy print ?    [html]  view plain copy print ? permission android:nameandroid.permission.FORCE_STOP_PACKAGES    android:permissionGroupandroid.permission-group.SYSTEM_TOOLS    android:protectionLevelsignature    android:labelstring/permlab_forceStopPackages    android:descriptionstring/permdesc_forceStopPackages/   注意protectionLevel属性值未signature。看sdk文档http://developer.android.com/guide/topics/manifest/permission-element.html#plevel中对这一属性的解释如下 A permission that the system grants only if the requesting application is signed with the same certificate as the application that declared the permission. If the certificates match, the system automatically grants the permission without notifying the user or asking for the users explicit approval. 意思是app使用FORCE_STOP_PACKAGES权限app必须和这个权限的声明者的签名保持一致 FORCE_STOP_PACKAGES的声明者是frameworks/base/core/res/,可以在frameworks/base/core/res/Android.mk中看到它的签名信息 [html]  view plain copy print ? LOCAL_NO_STANDARD_LIBRARIES : true   LOCAL_PACKAGE_NAME : framework-res   LOCAL_CERTIFICATE : platform   即签名为platform.  最终得到结论app需要是platform签名才可以使用forceStopPackage方法 网上有很多文章提及需要在app的AndroidManifest.xml中添加android:sharedUserIdandroid.uid.system一句话。看sdkhttp://developer.android.com/guide/topics/manifest/manifest-element.html对此的解释 android:sharedUserId The name of a Linux user ID that will be shared with other applications. By default, Android assigns each application its own unique user ID. However, if this attribute is set to the same value for two or more applications, they will all share the same ID — provided that they are also signed by the same certificate. Application with the same user ID can access each others data and, if desired, run in the same process. 意思是两个app使用了相同的user id就可以互相访问对方的数据。因此app使用android.uid.system的user id就可以访问系统数据。注意背景为黄色的一句这里依然需要两个app有相同的签名才行。
http://www.hkea.cn/news/14364031/

相关文章:

  • 免费申请论坛网站广州网站关键词优化推广
  • 中资源 网站域名解析域名解析后网站打不开
  • 网站运营写营销上海品牌网站建设公司
  • 企业能建站吗免费做一建或二建题目的网站
  • 如何做网站收徒弟网站官方百度app下载
  • 阿里云备案网站建设方案书范文58同城免费发布信息
  • 网站建设与网页制作盒子模型问答网站开发
  • 郑州高端网站公司重庆网站免费优化
  • 南京和筑建设有限公司网站网站优化体验报告
  • 网站主机免费申请甘肃省长城建设集团网站
  • 网站开发技术架构wordpress 公式
  • 网页设计作业在线网站首页sem培训学校
  • 黄山网站建设免费咨询快速搭建网站 数据存储
  • 中国未来巨型空间站装修设计软件免费版下载
  • 网站顶部下拉广告代码番禺网站开发技术
  • node做网站后台wordpress产品增加视频
  • 手机直播网站开发《php与mysql网站开发全接触》光盘源码.rar
  • 怎么做分享软件的网站检察院门户网站建设
  • 手机开发网站教程做外贸a货网站
  • 自己建个网站多少钱网站做行测题
  • 北京高端网站建设宣传陵水网站建设
  • 温州专业全网推广建站公司网站开发赚钱么
  • 手机网站制作天强科技福州公司网站
  • 中国做的比较好的网站设计公司有哪些合肥建公司网站
  • vue单页面做网站加载慢网站建设基本标准
  • 自己建个电影网站可以吗免费做的英文网站
  • HTML和PHP怎么做网站爱站网功能
  • 进下加强新闻宣传网站建设深圳网站设计公司让您放心省心
  • 移动网站建站视频商业网页设计与制作图片
  • 湘潭网站建设 沟通磐石网络北京国税局网站做票种核定