Created
July 12, 2017 09:12
-
-
Save mizchi/82d1683539187e50af0aeed90ad4f35a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* @flow */ | |
import { Permissions, Notifications } from 'expo' | |
// This code does not work on emulator | |
async function registerPushNotificationService() { | |
const { status } = await Permissions.askAsync( | |
Permissions.REMOTE_NOTIFICATIONS | |
) | |
if (status !== 'granted') { | |
return | |
} | |
return Notifications.getExponentPushTokenAsync() | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
⋊> ~/s/my-expo-app on master ⨯ curl -iv -H 'accept: application/json' -H 'accept-encoding: gzip, deflate' -H 'content-type: application/json' -d '[{"to":"ExponentPushToken[xxxxxxxxxxxxxx]", "body":"wut up", "badge": 1, "data":{"a":"b"}}]' https://exp.host/--/api/v2/push/send | |
* Trying 35.184.55.1... | |
* TCP_NODELAY set | |
* Connected to exp.host (35.184.55.1) port 443 (#0) | |
* TLS 1.2 connection using TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 | |
* Server certificate: expo.io | |
* Server certificate: Let's Encrypt Authority X3 | |
* Server certificate: DST Root CA X3 | |
> POST /--/api/v2/push/send HTTP/1.1 | |
> Host: exp.host | |
> User-Agent: curl/7.51.0 | |
> accept: application/json | |
> accept-encoding: gzip, deflate | |
> content-type: application/json | |
> Content-Length: 99 | |
> | |
* upload completely sent off: 99 out of 99 bytes | |
< HTTP/1.1 200 OK | |
HTTP/1.1 200 OK | |
< Server: nginx/1.11.3 | |
Server: nginx/1.11.3 | |
< Date: Wed, 12 Jul 2017 09:08:21 GMT | |
Date: Wed, 12 Jul 2017 09:08:21 GMT | |
< Content-Type: application/json; charset=utf-8 | |
Content-Type: application/json; charset=utf-8 | |
< Content-Length: 26 | |
Content-Length: 26 | |
< Connection: keep-alive | |
Connection: keep-alive | |
< Vary: Accept-Encoding | |
Vary: Accept-Encoding | |
< Set-Cookie: ks=s-lQLP3vt7StGbk4gIz8cWmA; path=/; secure; httponly | |
Set-Cookie: ks=s-lQLP3vt7StGbk4gIz8cWmA; path=/; secure; httponly | |
< Set-Cookie: kb=b-C7mihPLkQ2mhtgjS3uDVnQ; path=/; expires=Sun, 24 Sep 3015 10:40:00 GMT; secure; httponly | |
Set-Cookie: kb=b-C7mihPLkQ2mhtgjS3uDVnQ; path=/; expires=Sun, 24 Sep 3015 10:40:00 GMT; secure; httponly | |
< Strict-Transport-Security: max-age=15724800; preload | |
Strict-Transport-Security: max-age=15724800; preload | |
< X-Content-Type-Options: nosniff | |
X-Content-Type-Options: nosniff | |
< | |
* Curl_http_done: called premature == 0 | |
* Connection #0 to host exp.host left intact | |
{"data":[{"status":"ok"}]}⏎ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment