Can i have examples of cordova plugins which is running?


#1

angular.module(‘FirstApp’, [‘ionic’])
 .controller(‘InAppCtrl’, function($scope) {

$scope.alertDismissed = function () {
    alert(“kjddkldkl”)
  };
  $scope.inAppProjects = function () {
    navigator.notification.alert(
        ‘You are the winner!’,  // message
        alertDismissed,         // callback
        ‘Game Over’,            // title
        ‘Done’                  // buttonName
    )
  };
.inAppProjects will be called by ng-click inside button and it is nit reacting anything on click.


#2

Error:Error: navigator.notification is undefined
$scope.inAppProjects@http://192.168.1.255:8100/js/app.js:48:5
Parser.prototype.functionCall/<@http://192.168.1.255:8100/lib/ionic/js/ionic.bundle.js:19687:1
@http://192.168.1.255:8100/lib/ionic/js/ionic.bundle.js:42909:30
$RootScopeProvider/this.$get</Scope.prototype.$eval@http://192.168.1.255:8100/lib/ionic/js/ionic.bundle.js:21549:9
$RootScopeProvider/this.$get</Scope.prototype.$apply@http://192.168.1.255:8100/lib/ionic/js/ionic.bundle.js:21647:11
@http://192.168.1.255:8100/lib/ionic/js/ionic.bundle.js:42908:7
createEventHandler/eventHandler/<@http://192.168.1.255:8100/lib/ionic/js/ionic.bundle.js:11841:7
forEach@http://192.168.1.255:8100/lib/ionic/js/ionic.bundle.js:9351:7
createEventHandler/eventHandler@http://192.168.1.255:8100/lib/ionic/js/ionic.bundle.js:11840:5
triggerMouseEvent@http://192.168.1.255:8100/lib/ionic/js/ionic.bundle.js:2740:3
tapClick@http://192.168.1.255:8100/lib/ionic/js/ionic.bundle.js:2729:3
tapMouseUp@http://192.168.1.255:8100/lib/ionic/js/ionic.bundle.js:2799:5
 http://192.168.1.255:8100/lib/ionic/js/ionic.bundle.js
Line 18930


#3

Are you checking in browser ??
If yes then
You should check in device. It will work in device only.


#4

i tried on emulator but it is not responding after clicking .Any other thing you know?


#5

Did you add the plugin ??
If not, please add first…
$ cordova plugin add org.apache.cordova.core.dialogs
 $ cordova plugin add org.apache.cordova.core.vibration


#6

Hi Shashikant thanks for your reply ,I did install the plugin $ cordova plugin add org.apache.cordova.core.dialogs as i need to show only notification .

Acutally the problem is “navigator.notification.confirm(’ Have you shortlisted!’,alertConfirm,‘Best of luck’,‘Go,Cancel’);” this function

It showing undefined for navigator

Thanks


#7

I am not able to reproducible .
For me in device it is working…

navigator.notification.alert('Please enter valid search terms.', null, 'Error', 'OK');

#8

Try to remove plugin and add again … may be it will start working…


#9

Take a look in your plugin folder if the plugin is there.
Print out your navigator via console.log if there is anything found for other plugins or your notification plugin.

If not your plugin is not successfully adde or you are not running it on a mobile environment as @shashikant mentioned before.


#10

@bengtler thanks for your reply ,
When i printed the navigator value then it showing something like this as below it mean that plugin is installed right?
Navigator {webkitPersistentStorage: DeprecatedStorageQuota, webkitTemporaryStorage: DeprecatedStorageQuota, geolocation: Geolocation, doNotTrack: null, onLine: true…}

But I don’t understand why it is not working when i am calling something ???

Thanks


#11

I am also using camera plugin and getting the same issue

Thanks


#12

Error: navigator.notification is undefined in ionic


#13

yeah but if your camera and notification key is not found on the navigator object your plugin is not correct added.


#14

Can you try debug using alert in notification.js file ?


#15

Ya @bengtler I tried that as well by uninstalling the plugin but when i tried to remove the plugin then it giving me error

And another thing when I tried to add the same plugin then it showing message plugin is already installed

Even I make a new project tried the same thing but having same issue

I m using cordova 3.5 may this create a problem ???

Thanks


#16

Yeah shashikant you were right but hw can i get alert from notification.js as it is giving me error, while running the program ?

And infact i use alerts on notification.js file but nothing appeared??

Thanks


#17

what command are you using for removing plugin???


#18

After install plugin go inside folder.
If you are using android platform…

platforms\android\assets\www\plugins\org.apache.cordova.dialogs\www\notification.js put alert and run. alert will come....

#19

Yes I got alert from notification.js and i am using mac , but what is the solution for that , how can i get alert of notification?


#20

Did you try alert in side-

alert: function(message, completeCallback, title, buttonLabel) {
        var _title = (title || "Alert");
        var _buttonLabel = (buttonLabel || "OK");
        exec(completeCallback, null, "Notification", "alert", [message, _title, _buttonLabel]);
    },

Can you create github for that project? Then i can resolve you problem easily.