ionic-team / capacitor

Build cross-platform Native Progressive Web Apps for iOS, Android, and the Web ⚡️
https://capacitorjs.com
MIT License
12.16k stars 1.01k forks source link

Gettin the error message `not avaiable` when calling `PushNotifications.createChannel` #1563

Closed guilhermegjr closed 5 years ago

guilhermegjr commented 5 years ago

Description of the problem:

I am trying to create a Push Notification Channel and I am getting the error "not avaiable".

Affected platform

OS of the development machine

Other information:

Capacitor version: 6.9.0

node version: v10.14.1

npm version: 6.9.0

CocoaPods version: 1.7.0

Steps to reproduce:

  1. Add the code bellow in ngOnInit() on app.component.ts:
PushNotifications.register();

PushNotifications.createChannel({
    id: 'PushPluginChannel',
    description: 'PushPluginChannel',
    importance: 5,
    visibility: 1,
    name: 'PushPluginChannel',
})
    .then(sucesso => console.log('sucess', sucess))
    .catch(erro => console.error('error', error));

PushNotifications.addListener('registration', token => {
    console.log(token);
});

PushNotifications.addListener('pushNotificationReceived', notification => {
    console.log(notification);
});

PushNotifications.addListener('registrationError', error => {
    console.log(error);
});
  1. Build do app with ng build

  2. npx cap copy

  3. npx cap open android

  4. Execute the app on real device

jcesarmobile commented 5 years ago

what's the Android version of the device? channels are only available on Android O and newer (SDK 26)

guilhermegjr commented 5 years ago

what's the Android version of the device? channels are only available on Android O and newer (SDK 26)

I didn't know that.

The android version I was using is the Nougat 7.0 (SDK 24).

Thanks for your answer.

jpmc3630 commented 4 years ago

@jcesarmobile Is there anyway to get local notifications to the front without the channels? I was trying to support Android 7

ionitron-bot[bot] commented 1 year ago

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Capacitor, please create a new issue and ensure the template is fully filled out.