Created
January 20, 2017 20:27
-
-
Save LuisRodriguezLD/0257300f08eae90e97d81682148c8b22 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
function APNStoFCM(token) { | |
var body = { | |
application : 'com.your.app', | |
sandbox : true, | |
apns_tokens : [ | |
token | |
] | |
}; | |
var options = { | |
method: "POST", | |
headers: { | |
'Accept': 'application/json', | |
"Content-type": "application/json; charset=UTF-8", | |
'Authorization' : 'key=your_key' | |
}, | |
body: JSON.stringify(body) | |
} | |
fetch("https://iid.googleapis.com/iid/v1:batchImport", options) | |
.then(function(response) { | |
return response.json(); | |
}).then(function(response) { | |
console.log("Prueba " + JSON.stringify(response)) | |
}).catch(function(error) { | |
console.log("Error " + JSON.stringify(error)) | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment