notifications.register
Registers the device for remote push and resolves with the token a server
sends to. Call it on each launch: the token can change. iOS only for now;
Android rejects with ERR_UNSUPPORTED (docs/notifications.md#remote-push).
Utilização
Obtain an iOS push token.
// Obtain an iOS push token.
import { notifications, platform } from 'kuito';
// On each launch: the token can change. Android rejects with ERR_UNSUPPORTED for now.
if (platform === 'ios') {
const { service, token } = await notifications.register();
await fetch('https://api.example.com/devices', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ service, token }),
});
}Assinaturas
(): Promise<Token>Parâmetros
Sem parâmetros.
Devolve
Promise<Token>
Gerado a partir das declarações TypeScript públicas: assinaturas, props e predefinições vêm da fonte verificada, as descrições da sua JSDoc. Nenhuma predefinição é inventada.