Brief: This series of articles will give a comprehensive introduction to EXPO. Since I came into contact with EXPO in June 2017, I have been studying EXPO off and on for nearly 10 months. I don’t want to say any more

I guess we can make up for EXPO in the form of all computer translation + personal modification +demo test! Welcome to join EXPO Interest learning exchange Group: 597732981

I’ve written a list of expo and RN introductory configurations that you can read here: Learning RN Development from Scratch.

Related articles:

What is Expo, how to install Expo Clinet and XDE, and how to use XDE

The Expo campaign (II)– the life cycle of Expo, the ways of Expo community communication, the necessary resources for learning Expo, and some issues to be concerned about when developing and using Expo

Expo (III)– Targeted at developers who have already developed React Native projects, we introduced Expo, limitations of Expo, and points to note in project selection during development

Expo (4)– Quickly build an app with Expo, the key term in Expo

5. Configuration information of the app. Json file in Expo

Expo big battle (vi)– Expo development mode, EXP command line tool in Expo, how to view log in Expo, debugging way in Expo

How does Expo use Genymotion simulator

(8)– Publish in Expo and link in Expo. I haven’t looked at link in detail. Please come and communicate with me

More > >

If I write after Chapter 23, the previous translation, whether good or not, will come to an end after all, and I will have an in-depth understanding of the basic theories of EXPO. The following expo series will mainly introduce the API of EXPO SDK.

Rights (Permissions)

When adding features that give access to potentially sensitive information on a user’s device, such as its location, or may send push notifications that may not be needed, you need to ask the user for permission first. Unless you’ve already asked their permission, then no need. So we have the permission module.

If you are deploying your application to the Apple iTunes Store, consider adding additional metadata to your application to customize the system permissions dialog box and explain why your application needs permissions. See the App Store Deployment Guide for more information.

Expo.Permissions.getAsync(type)

Determines whether your application has been granted access to the provided permission types.

parameter

Type (string) – The name of the permission.

return

Return a Promise resolved with information about the permission, including status, expiration, and scope if it applies to the permission type. (Returns a Promise that is resolved with the information about the permission, including status, expiration and scope (if it applies to the permission type).)

async function alertIfRemoteNotificationsDisabledAsync() {
  const { Permissions } = Expo;
  const { status } = await Permissions.getAsync(Permissions.NOTIFICATIONS);
  if(status ! = ='granted') {
    alert('Hey! You might want to enable notifications for my app, they are good.'); }}Copy the code

Expo.Permissions.askAsync(type)

Prompt the user for permission. If they have granted access, the response will succeed.

parameter

Type (string) – The name of the permission.

return

Return a Promise resolved with information about the permission, including status, expiration, and scope if it applies to the permission type.

async function getLocationAsync() {
  const { Location, Permissions } = Expo;
  const { status } = await Permissions.askAsync(Permissions.LOCATION);
  if (status === 'granted') {
    return Location.getCurrentPositionAsync({enableHighAccuracy: true});
  } else {
    throw new Error('Location permission not granted'); }}Copy the code

Expo.Permissions.NOTIFICATIONS

Local and push notification permission types.

Note: On iOS, this does not eliminate the undetermined rejection, so only granted or undetermined is returned. This is due to the way the underlying native API is implemented.

Expo. Permissions. The LOCATION LOCATION access types.

Expo.Permissions.CAMERA Type of permission for taking photos and videos.

Expo.Permissions.AUDIO_RECORDING Specifies the license type for audio recording.

Expo. Permissions. CONTACTS read permission to contact type.

Expo.permissions.CAMERA_ROLL The type of permission used to read or write to the camera.

A Pedometer (Pedometer)

Get the user’s steps using Core Motion (iOS) or Google Fit (Android).

Expo. Pedometer. IsAvailableAsync ()

Determine if the pedometer is working.

return

Returns a promise, parsed as a Boolean value, indicating whether the pedometer is available on this device.

Expo.Pedometer.getStepCountAsync(start, end)

Gets the number of steps between two dates.

parameter

Start (datetime) – Indicates the date on which the range of measurement steps begins. End (end) – Indicates the date on which the range of the measurement step ends.

return

Returns a promise resolved to Object using the Steps key, which is a Number representing the Number of steps taken between a given date.

Expo. Pedometer. WatchStepCount (the callback)

Subscribe to pedometer updates.

parameter

Callback A callback function that is called when new step data is available. The callback provides a single parameter, which is an object with a step key.

return

An EventSubscription object that you can call remove () when you want to unsubscribe a listener.

Permissions for the Expo SDK API

.

Welcome to pay attention to my wechat public number, whether this article is recognized by everyone, my standard is public
The number of fans has increased. Welcome to reprint, but must keep my blog link!