<korzysta z uprawnień>
Zadbaj o dobrą organizację dzięki kolekcji
Zapisuj i kategoryzuj treści zgodnie ze swoimi preferencjami.
Uwaga: w niektórych przypadkach wymagane uprawnienia
do <uses-permission>
może wpływać na sposób filtrowania przez Google Play
aplikacji. Jeśli poprosisz o uprawnienia związane ze sprzętem, takie jak
CAMERA
, Google Play zakłada, że Twoja
aplikacja wymaga odpowiedniej funkcji sprzętowej i filtruje aplikację
z urządzeń, które nie oferują tej funkcji.
Aby kontrolować filtrowanie, zawsze jawnie deklaruj
funkcje sprzętowe w elementach <uses-feature>
, a nie
dzięki Google Play wymagania
<uses-permission>
elementów. Następnie, jeśli chcesz wyłączyć
pod kątem konkretnej cechy, możesz dodać
android:required="false"
do zbioru danych
<uses-feature>
.
Dla listy uprawnień, które sugerują,
funkcji sprzętu można znaleźć w dokumentacji
<uses-feature>
.
- składnia:
<uses-permission android:name="string"
android:maxSdkVersion="integer" />
- zawarte w:
<manifest>
- description:
- Określa uprawnienia systemowe, które użytkownik musi przyznać
aby aplikacja działała prawidłowo. Użytkownik przyznaje uprawnienia, gdy
instalowania aplikacji na urządzeniach z Androidem 5.1 lub starszym oraz podczas działania aplikacji na urządzeniach z Androidem 6.0 lub nowszym.
Więcej informacji o uprawnieniach znajdziesz tutaj:
Uprawnienia
w omówieniu manifestu aplikacji oraz
Przewodnik po uprawnieniach na Androidzie.
Lista uprawnień zdefiniowana przez platformę podstawową znajduje się na stronie
android.Manifest.permission
- atrybuty:
android:name
- Nazwa uprawnienia. Może to być uprawnienie określone przez
aplikacji w programie
<permission>
, uprawnienie zdefiniowane przez inną aplikację lub jedno z
standardowych uprawnień systemowych, takich jak
"android.permission.CAMERA"
lub "android.permission.READ_CONTACTS"
. Jak widać na tych przykładach,
nazwa uprawnienia zwykle zawiera jako prefiks nazwę pakietu.
android:maxSdkVersion
- Najwyższy poziom interfejsu API, na którym przyznano aplikacji to uprawnienie.
Ustawienie tego atrybutu jest przydatne, jeśli uprawnienia wymagane przez aplikację nie są już potrzebne
na określonym poziomie interfejsu API.
Na przykład od Androida 4.4 (poziom interfejsu API 19) aplikacja nie jest już potrzebna
aby poprosić o WRITE_EXTERNAL_STORAGE
do zapisu w pamięci zewnętrznej we własnych katalogach aplikacji, które są
źródło: getExternalFilesDir()
.
Pamiętaj jednak:
uprawnienie jest wymagane w przypadku interfejsu API na poziomie 18 lub niższym. Możesz więc zadeklarować,
uprawnienia są potrzebne tylko do poziomu interfejsu API 18 z deklaracją podobną do tej:
<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
android:maxSdkVersion="18" />
W ten sposób, począwszy od poziomu interfejsu API 19, system nie będzie już przyznawać aplikacji
Uprawnienie WRITE_EXTERNAL_STORAGE
.
Dodano w interfejsie API poziomu 19.
- wprowadzone w:
- Poziom API 1
- zobacz też:
-
Treść strony i umieszczone na niej fragmenty kodu podlegają licencjom opisanym w Licencji na treści. Java i OpenJDK są znakami towarowymi lub zastrzeżonymi znakami towarowymi należącymi do firmy Oracle lub jej podmiotów stowarzyszonych.
Ostatnia aktualizacja: 2025-07-27 UTC.
[[["Łatwo zrozumieć","easyToUnderstand","thumb-up"],["Rozwiązało to mój problem","solvedMyProblem","thumb-up"],["Inne","otherUp","thumb-up"]],[["Brak potrzebnych mi informacji","missingTheInformationINeed","thumb-down"],["Zbyt skomplikowane / zbyt wiele czynności do wykonania","tooComplicatedTooManySteps","thumb-down"],["Nieaktualne treści","outOfDate","thumb-down"],["Problem z tłumaczeniem","translationIssue","thumb-down"],["Problem z przykładami/kodem","samplesCodeIssue","thumb-down"],["Inne","otherDown","thumb-down"]],["Ostatnia aktualizacja: 2025-07-27 UTC."],[],[],null,["# <uses-permission\u003e\n\n**Note:** In some cases, the permissions that you request\nthrough `\u003cuses-permission\u003e` can affect how Google Play filters your\napplication. If you request a hardware-related permission, such as\n`CAMERA`, Google Play assumes that your\napplication requires the underlying hardware feature and filters the application\nfrom devices that don't offer it.\n\nTo control filtering, always explicitly declare\nhardware features in `\u003cuses-feature\u003e` elements, rather than\nrelying on Google Play to \"discover\" the requirements in\n`\u003cuses-permission\u003e` elements. Then, if you want to disable\nfiltering for a particular feature, you can add a\n`android:required=\"false\"` attribute to the\n`\u003cuses-feature\u003e` declaration.\n\nFor a list of permissions that imply\nhardware features, see the documentation for the [`\u003cuses-feature\u003e`](/guide/topics/manifest/uses-feature-element#permissions-features) element.\n\nsyntax:\n:\n\n ```xml\n \u003cuses-permission android:name=\"string\"\n android:maxSdkVersion=\"integer\" /\u003e\n ```\n\ncontained in:\n: [\u003cmanifest\u003e](/guide/topics/manifest/manifest-element)\n\ndescription:\n\n: Specifies a system permission that the user must grant for the app to operate correctly. The user grants permissions when the application installs, on devices running Android 5.1 and lower, or while the app runs, on devices running Android 6.0 and higher.\u003cbr /\u003e\n\n\n For more information on permissions, see the\n [Permissions](/guide/topics/manifest/manifest-intro#perms)\n section in the app manifest overview and the\n [Permissions on Android](/guide/topics/permissions) guide.\n A list of permissions defined by the base platform is at\n [android.Manifest.permission](/reference/android/Manifest.permission).\n\nattributes:\n:\n\n `android:name`\n : The name of the permission. It can be a permission defined by the\n application with the [\u003cpermission\u003e](/guide/topics/manifest/permission-element)\n element, a permission defined by another application, or one of the\n standard system permissions, such as\n [\"android.permission.CAMERA\"](/reference/android/Manifest.permission#CAMERA)\n or [\"android.permission.READ_CONTACTS\"](/reference/android/Manifest.permission#READ_CONTACTS). As these examples show,\n a permission name typically includes the package name as a prefix.\n\n `android:maxSdkVersion`\n\n : The highest API level at which this permission is granted to your app. Setting this attribute is useful if the permission your app requires is no longer needed beginning at a certain API level.\u003cbr /\u003e\n\n For example, beginning with Android 4.4 (API level 19) it's no longer necessary for your app\n to request the [WRITE_EXTERNAL_STORAGE](/reference/android/Manifest.permission#WRITE_EXTERNAL_STORAGE)\n permission to write to its own application-specific directories on external storage, which are\n provided by [getExternalFilesDir()](/reference/android/content/Context#getExternalFilesDir(java.lang.String)).\n\n However,\n the permission *is required* for API level 18 and lower. So you can declare that this\n permission is needed only up to API level 18 with a declaration like the following: \n\n ```xml\n \u003cuses-permission\n android:name=\"android.permission.WRITE_EXTERNAL_STORAGE\"\n android:maxSdkVersion=\"18\" /\u003e\n ```\n\n This way, beginning with API level 19, the system no longer grants your app the\n `WRITE_EXTERNAL_STORAGE` permission.\n\n Added in API level 19.\n\nintroduced in:\n: API level 1\n\nsee also:\n:\n - [\u003cpermission\u003e](/guide/topics/manifest/permission-element)\n - [`\u003cuses-permission-sdk-23\u003e`](/guide/topics/manifest/uses-permission-sdk-23-element)\n - [\u003cuses-feature\u003e](/guide/topics/manifest/uses-feature-element)"]]