Native notifications


#1

I’ve looked through the ionic source and realized that native notifications using org.apache.cordova.dialogsare not implemented.

Are there any plans for this or are there any reasons I’m not aware of why this doesn’t make sense ?


#2

Any of the cordova plugins can be implemented with ionic, just only a few of them have been included with the CLI. You can add the dialog plugin via cordova’s plugin add command.

$ cordova plugin add org.apache.cordova.dialogs

Then you’ll have access to all of the plugins features.

navigator.notification.alert(
    'You are the winner!',  // message
    alertDismissed,         // callback
    'Game Over',            // title
    'Done'                  // buttonName
);

#3

I’m aware of that. I think I didn’t described precislly enough what I meant.

I’m talking about when using $ionicPopup.alertthat this will trigger automatically the native notification alert.


#4

Ahh, alright. No, when you trigger a popup, it is our own implementation of an alert basically.


#5

Yes, I know.
The question was: Are you’re going to implement native notifications or are there reasons against it ?
I think it will result in a better native-like user experience for hybrid apps.


#6

There are somethings in the works for notifications :smile:


#7

@mhartington do you see any disadvantages when using $ionicPopup compared to Cordova Dialogs?


#8

Depends oh what you need. If you need something like push notifications from apple or google cloud messages, it’s best off to use cordova notifications.

But if you’re just using them for in app notifications or in place of alerts, and don’t mind if they aren’t native, then ionic’s popup should work just fine


#9

I’ve played with Corda Dialogs for a bit now and they work fine. Except they look like they have the style from Android 2.3. Do you know anything about this? I’m using a Nexus 5 with Android 4.4


#10

They styling of the alerts is set in the plugin itself, android has themes or styles for alerts that can be used when calling the alert so that being said I would think this is plugin specific, ionic is just a framework ( currently )

That being said I don’t know if ionic would bake this into the css framework as it would close it out to only cordova and close it out to people who use trigger.io or other non-cordova build systems.


#11

I generally prefer to use the ionic pop ups because it has a uniform experience on both apps and is simple JavaScript. Also it can be themed to take apps skin which native cannot offer.
My Advice, use Ionic popus always except u are forced to use native for some reason.


#12

You can delete the cordova theme on these dialogs.
In the androidManifest of your project there is:

<activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:label="@string/app_name" android:name="HelloCordova" android:theme="@android:style/Theme.Black.NoTitleBar">

If you delete android:theme="@android:style/Theme.Black.NoTitleBar"
Dialogs will have the native android look


#13

Sorry for the late reply, but that change helped!
Thanks!