2013-01-13 2 views
0

나는 2 개의 간단한 프로젝트를 만들었습니다. 는 처음에 나는 명시하는 권한을 넣어 : 안드로이드 내 애플 리케이션 허가

<permission android:name="com.example.MODULE" 
      android:label="Example module" 
      android:protectionLevel="dangerous" /> 
<application android:label="@string/app_name" android:theme="@style/Theme.Sherlock.Light" android:icon="@drawable/ic_launcher"> 
    <activity android:name="MyActivity" 
       android:label="@string/app_name" 
       android:exported="true" 
       android:excludeFromRecents="true"> 
<intent-filter> 
      <action android:name="android.intent.action.MAIN"/> 
      <action android:name="com.example.graph.SHOW"/> 
      <category android:name="android.intent.category.DEFAULT" /> 
     </intent-filter> 

그리고 두 번째 프로젝트에서

:

<uses-permission android:name="com.example.MODULE"/

하지만 두 번째 프로젝트에서 사용-권한을 제거하고 활동을 시작하는 경우 :

startActivity(new Intent("com.example.graph.SHOW")) 

첫 번째 프로젝트 - 아직 시작 중입니다. 하지만 왜? 허가없이 어떻게 시작됩니까? 권한을 사용하여 두 번째 프로젝트를 올바르게 보호하는 방법

답변

0

응용 프로그램을 시작할 권한이 필요하지 않습니다. 개발자에게 권한을 요청하지 않고도 모든 앱을 실행할 수 있습니다. 예를 들어 개발자에게 묻지 않고이 코드를 실행할 수 있습니다 (유명한 바코드 스캐너를 시작합니다). `<액션 안드로이드 : 이름 = "com.example.graph.SHOW"/>`

Intent intent = new Intent("com.google.zxing.client.android.ENCODE"); 
intent.putExtra("ENCODE_TYPE", "TEXT_TYPE"); 
intent.putExtra("ENCODE_DATA", output); 
intent.putExtra("ENCODE_FORMAT", "QR_CODE"); 
intent.putExtra("ENCODE_SHOW_CONTENTS", false); 
+1

이 답변에 추가하려면 OP의 첫 번째 프로젝트는 '의도 filter'을 추가하여 활동을 수출하고있다. 이렇게하면 ** 모든 ** 앱이 활동을 시작할 수 있습니다. –

+0

모든 앱을 제한 할 수 있습니까? 일부 "비밀번호"/ 권한이있는 앱에 대해서만 내 활동을 시작하고 싶습니다. – user1766287

+0

http://developer.android.com/guide/components/intents-filters.html 및 http://developer.android .com/guide/topics/manifest/intent-filter-element.html – ObAt

관련 문제