android - 指定调用此应用的包名

标签 android android-intent

我的应用 AndroidManifest.xml

 <activity
    android:name="com.test.orc.IdentifyIdcards"
    android:screenOrientation="landscape" >
      <intent-filter>
                    <action android:name="com_test_orc_IdentifyIdcards" />

                    <category android:name="android.intent.category.DEFAULT" />
                </intent-filter>
            </activity>

所以任何应用程序都可以调用我的应用程序

Intent intent = new Intent();
intent.setAction("start_photo_identify_picture_activity");
startActivity(intent); 

但是我限制只有包名是com.test.idcard才能调用我的app,怎么办?

最佳答案

您需要指定 <permission>在 list 上,特别是你想要

android:protectionLevel="signature"

Read more here: https://developer.android.com/guide/topics/manifest/permission-element.html

关于android - 指定调用此应用的包名,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40651370/

相关文章:

android - 使用 Intent.ACTION_GET_CONTENT 时如何避免 "SecurityException"

Android - 打开电子邮件应用程序?

java - android:在不丢失数据的情况下返回主 Activity

java - 由于找不到 tools.jar,运行 android 构建失败以响应 native 项目

android - 如何在 Android 中的点击位置放置自定义对话框?

java - List<> 对象引用如何工作?

android - 如何在 Intent 之间传递 bool 值

android - 使用 Intent 将变量传递给 Zooper 小部件

android - 如何获得包含三个字母月份的相对时间字符串?

android - 如何在 Manifest.json 中设置 minSdkVersion (Android/Ionic)