mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Updated docs for next
This commit is contained in:
@@ -3,13 +3,13 @@ Some permissions are granted by default when the application is installed
|
||||
so long as they appear in <code>AndroidManifest.xml</code>. However, "dangerous"
|
||||
permissions require a dialog prompt. You should use this module for those
|
||||
permissions.</p><p>On devices before SDK version 23, the permissions are automatically granted
|
||||
if they appear in the manifest, so <code>checkPermission</code> and <code>requestPermission</code>
|
||||
if they appear in the manifest, so <code>check</code> and <code>request</code>
|
||||
should always be true.</p><p>If a user has previously turned off a permission that you prompt for, the OS
|
||||
will advise your app to show a rationale for needing the permission. The
|
||||
optional <code>rationale</code> argument will show a dialog prompt only if
|
||||
necessary - otherwise the normal permission prompt will appear.</p><h3><a class="anchor" name="example"></a>Example <a class="hash-link" href="docs/permissionsandroid.html#example">#</a></h3><div class="prism language-javascript">async <span class="token keyword">function</span> <span class="token function">requestCameraPermission<span class="token punctuation">(</span></span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
|
||||
<span class="token keyword">try</span> <span class="token punctuation">{</span>
|
||||
const granted <span class="token operator">=</span> await PermissionsAndroid<span class="token punctuation">.</span><span class="token function">requestPermission<span class="token punctuation">(</span></span>
|
||||
const granted <span class="token operator">=</span> await PermissionsAndroid<span class="token punctuation">.</span><span class="token function">request<span class="token punctuation">(</span></span>
|
||||
PermissionsAndroid<span class="token punctuation">.</span>PERMISSIONS<span class="token punctuation">.</span>CAMERA<span class="token punctuation">,</span>
|
||||
<span class="token punctuation">{</span>
|
||||
<span class="token string">'title'</span><span class="token punctuation">:</span> <span class="token string">'Cool Photo App Camera Permission'</span><span class="token punctuation">,</span>
|
||||
|
||||
Reference in New Issue
Block a user