最後更新日期:2022 年 09 月 27 日

使用權限的宣告

在使用一些功能前,必須在這些先行宣告;如果有比較可能危害安全性或隱私的權限,還需要另外在執行時期請求使用者允許使用。

例:使用網路功能

<uses-permission android:name="android.permission.INTERNET" />

例:使用相機

<uses-permission android:name="android.permission.CAMERA" />
<activity
    android:name=".MainActivity"
    android:exported="true">

指定自訂的 Application

<application
    android:name=".MyApplication"
    ... >

設定 Activity 的屬性

android:exported : 設定是否可讓其他 app 呼叫

exported 的值為 true 表示可以讓其他 app 呼叫,通常 MainActivity 的 exported 值均為 true。

參考資料

developers Guides: App Manifest

Last modified: 2022 年 9 月 27 日

Author

Comments

Write a Reply or Comment

Your email address will not be published.