Giter Site home page Giter Site logo

phonegapbuildpushproject2's Introduction

This file was created by JetBrains PhpStorm 4.0.3 for binding GitHub repository

phonegapbuildpushproject2's People

Contributors

hollyschinsky avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

phonegapbuildpushproject2's Issues

Push Notification : ecb function executes for first time only.

Hi,
I am trying to develop android app using PhoneGap and AngularJS. Push notifications are working good but the only problem is that the ecb function executes for the first time of the compilation. I have alert text inside ecb function. I got the push notifications on notification bar but on clicking them doesn't call ecb funciton, only app starts.
After i restart the app, although app is running , i got the notification in notification bar and ecb function is not working.
Please help me..
I have posted my sample code related to GCM: Push notification

.factory('GCM', ["$window", "$rootScope", function ($window, $rootScope){

    function registerGCM(){
        var pushNotification;
        pushNotification = window.plugins.pushNotification;
        pushNotification.register(
        successHandler,
        errorHandler, {
            "senderID":"676655225205",
            "ecb":"onNotificationGCM"
        });

    }

    function successHandler(result){
         //alert('result = ' + result);
    }

    function errorHandler(error){
        alert(error);   
    }

    $window.onNotificationGCM = function (e){
        switch(e.event){
            case 'registered':
                if ( e.regid.length > 0 )
                {
                    $rootScope.$broadcast('reg_key', e.regid);
                }
                break;

            case 'message':
                alert('ecb function is called');
                break;

            case 'error':
                alert('GCM error = '+e.msg);
                break;

            default:
                alert('An unknown GCM event has occurred');
                break;
        }
        return true;
    }

    return{
        register: function(){
            return registerGCM();
        }           
    };
}]);

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.