zoukankan      html  css  js  c++  java
  • Android自定义权限

    1、在被调用程序Called的AndroidManifest.xml文件中作如下定义:

    <!-- Service Permission -->
      <permission
        android:name="com.uperone.permission.SERVICE"
        android:label="@string/app_name"
        android:permissionGroup="@string/app_name"
        android:protectionLevel="normal" >
      </permission>

    关于各标签属性的意义自行脑补,都是见名知意。

    <service
      android:name="com.uperone.called.service.CalledService"
      android:permission="com.uperone.permission.SERVICE">
      <intent-filter>
          <action android:name="com.uperone.action.SERVICE" />
          <category android:name="android.intent.category.DEFAULT"/>
      </intent-filter>
            </service>

    2、 在需要调用该组件的应用程序Call工程的AndroidManifest.mxl文件中声明对应的权限:

    <uses-permission android:name="com.uperone.permission.SERVICE" />

    3、在需要调用该组件的应用程序Call工程中启动、停止改服务:

    case R.id.startServiceBtnId:{
          Intent intent = new Intent( "com.uperone.action.SERVICE" );
          startService(intent);
        }
        break;
  • 相关阅读:
    模拟测试48
    模拟测试47
    模拟测试46
    NOIP模拟测试29(A)
    NOIP模拟测试19
    NOIP模拟测试18(T3待更新)
    杂题
    noip模拟测试18 T2搜索
    noip模拟测试17 2019-08-11 考后反思
    noip模拟测试14 20190807 考试反思
  • 原文地址:https://www.cnblogs.com/yuanting/p/4775663.html
Copyright © 2011-2022 走看看