首页 > 其他 > 详细

Exported activity does not require permission

时间:2014-12-12 13:11:44      阅读:243      评论:0      收藏:0      [点我收藏+]

问题:

今天在AndroidManifest.xml文件中配置Activity后,系统提示我“Exported activity does not require permission”。我配置的代码如下:

 

<activity android:name="com.example.testmain.ShowActivity" >
             <intent-filter>
                 <action android:name="test.update.mydata" />

                 <category android:name="my.test.show" />
             </intent-filter>
         </activity>

 

原因:

查了一下资料,原来是因为我给Activity配置了<intent-filter>属性,配置<intent-filter>属性,就意味着这个Activity可以被其他App程序所使用。但是怎么样即配置<intent-filter>属性,有防止被其他App使用呢?这里主要有两个解决办法!

 

第一种:

通过添加android:exported="false"属性。这个属性用于指示该服务是否能够被其他应用程序组件调用或跟它交互。如果设置为true,则能够被调用或交互,否则不能。设置为false时,只有同一个应用程序的组件或带有相同用户ID的应用程序才能启动或绑定该服务。

  <activity
            android:name="com.example.testmain.ShowActivity"
            android:exported="false" >
            <intent-filter>
                <action android:name="test.update.mydata" />
                <category android:name="my.test.show" />
            </intent-filter>
     </activity>

 

第二种:

通过添加<permission>权限来控制其他App对服务的访问!

 

Exported activity does not require permission

原文:http://www.cnblogs.com/ywtk/p/4159445.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!