Giter Club home page Giter Club logo

Comments (38)

macdonst avatar macdonst commented on July 20, 2024

@bau720123 Really, I've never seen the registration trigger twice on iOS. Can you put up a gist of the html/js you are using that can reproduce the problem?

from phonegap-plugin-push.

bau720123 avatar bau720123 commented on July 20, 2024

hi @macdonst
thanks for your reply
well...the code just like the example code

var push = PushNotification.init({ "android": {"senderID": "my_sender_id"},
         "ios": {}, "windows": {} } );

    push.on('registration', function(data) {
        alert(data.registrationId); //it will trigger twice times in my iOS 8.4
    });

    push.on('notification', function(data) {
        //not try yet...
    });

    push.on('error', function(e) {
        //not try yet...
    });

but I am using PGB (build.phonegap.com) Cli 5.1.1 with all official core plugin from NPM

from phonegap-plugin-push.

macdonst avatar macdonst commented on July 20, 2024

@bau720123 I'm running iOS 8.4 on my test device and I can't reproduce this at all. Do you have a link to the github repo you use to test on PGB?

from phonegap-plugin-push.

bau720123 avatar bau720123 commented on July 20, 2024

hi @macdonst
problem solved (so strange...)
anyway ~ thanks

from phonegap-plugin-push.

Mojo90 avatar Mojo90 commented on July 20, 2024

@bau720123
what was your Problem?
Because mine is also called twice or sometimes even 3 times.....
My assumption is that it has to do with this plugin: https://github.com/katzer/cordova-plugin-local-notifications but not sure yet

from phonegap-plugin-push.

bau720123 avatar bau720123 commented on July 20, 2024

hi @Mojo90
have you ever use the old "plugin-notification"
https://github.com/phonegap-build/PushPlugin
if yes,remove it,rebuild it,clean the app's cache
and try again...

from phonegap-plugin-push.

Mojo90 avatar Mojo90 commented on July 20, 2024

no unfortunately not :-(. Still investigating...

from phonegap-plugin-push.

bau720123 avatar bau720123 commented on July 20, 2024

hi @Mojo90
how about paste your full code here

from phonegap-plugin-push.

Mojo90 avatar Mojo90 commented on July 20, 2024

@bau720123 here is a snippet:
initPushService is called from device-ready method.
and then my registerPushAtServer is called twice, 3x or 4x on iOS. I handle it now and do only update devicetoken on parse.com when it changed. but nevertheless it is a strange behavior

function initPushService(){

var push = PushNotification.init({ 
            "android": {"senderID": "XXXXX"},
            "ios": {}, 
            "windows": {} 
        });

push.on('registration', function(response) {
    registerPushAtServer(response);
});

push.on('notification', function(data) {
    handlePushNotification(data)
});

push.on('error', function(e) {
    // e.message
    console.log("Push Error: " + e);
});

}

it is strange because on android it is only called once.

from phonegap-plugin-push.

bau720123 avatar bau720123 commented on July 20, 2024

hi @Mojo90
try to just only use "alert(response)" or "console.log(response)" first
to see if it will work only trigger one time
if will,I think maybe your "registerPushAtServer" problem

from phonegap-plugin-push.

Mojo90 avatar Mojo90 commented on July 20, 2024

thanks @bau720123
tried it, but same behavior. I really think that it has some problems with the local notifications plugin from katzer. but couldn't figured out yet whats the problem. really these are two good plugins and the notifications plugin has completely stopped working since I installed this Push Plugin here :-(

from phonegap-plugin-push.

bau720123 avatar bau720123 commented on July 20, 2024

hi @Mojo90 and @macdonst
for now I am facing the same problem ("registration" will trigger twice times that only in iOS)
I am try to figure out what the problem is...

I am using PGB 5.2.0 + plugin 1.2.3 version from npm + iOS9 (cordova cli maybe no problem,but PGB indeed)

from phonegap-plugin-push.

Mojo90 avatar Mojo90 commented on July 20, 2024

@bau720123 Are you using Local Notification Plugin as well? Because I think for me it is called twice because I use both plugins. Anyway as mentioned by me it is ok for now because I am only updating sth if Device Token changed otherwise nothing happens...

from phonegap-plugin-push.

bau720123 avatar bau720123 commented on July 20, 2024

got it
thanks @Mojo90
I will try delete the "Local Notification" first to see if anything change
feedback later...

from phonegap-plugin-push.

bau720123 avatar bau720123 commented on July 20, 2024

hi @Mojo90
just like you said
is the "the "Local Notification" problem
thanks a lot

from phonegap-plugin-push.

Mojo90 avatar Mojo90 commented on July 20, 2024

@bau720123 No problem. If you fixed it please let me know. But at the moment I just ignore...

from phonegap-plugin-push.

bau720123 avatar bau720123 commented on July 20, 2024

hi @Mojo90 and @macdonst
I notice that the problem is not "Local Notification"
for now I am just using core plugin + push plugin
push

but still facing same problem that only in iOS (I am in iOS 9)
when you install your ipa to your ios device

launch it...
first time,the app will ask you if turn on the notification,select yes,after it,trigger only one time

close the app and launch it again...
second time,because first time the app have been ask you before,so...won't ask again,after it, trigger twice time

my full code,index.html

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=0">
<title>PhoneGap with jQuery Mobile</title>
<script src="cordova.js" type="text/javascript"></script>
<script type="text/javascript">
document.addEventListener("deviceready", initialize, false);
function initialize()
{
var push = PushNotification.init({ "android": {"senderID": "XXXXYYYZZZ"}, "ios": {"alert": "true", "badge": "true", "sound": "true"}, "windows": {} } );

push.on('registration', function(data)
{
alert(data.registrationId);
});

push.on('notification', function(data)
{
alert(data);
});

push.on('error', function(e)
{
alert(e.message);
});
}
</script>
</head>

<body>
</body>
</html>

from phonegap-plugin-push.

bau720123 avatar bau720123 commented on July 20, 2024

hi @Mojo90 and @macdonst
finally figure it out
according above (PGB 5.2.0 + all latest core plugin + 1.2.3 push + all same code)
ipad mini (9.0 13A344) => have twice problem
iphone 6 plus (8.4.1 12H321) => have no twice problem
so...I guess it is the iOS version problem

from phonegap-plugin-push.

wakeupmh avatar wakeupmh commented on July 20, 2024

Hi @bau720123 , I have tested your code, but in my app it doesn't works, Can you help me ?

from phonegap-plugin-push.

macdonst avatar macdonst commented on July 20, 2024

@bau720123 Yeah, I've been able to reproduce this on an iOS9 device as well.

from phonegap-plugin-push.

bau720123 avatar bau720123 commented on July 20, 2024

hi @wakeupmh
is your deviceready trigger ?
please confirm this first

from phonegap-plugin-push.

bau720123 avatar bau720123 commented on July 20, 2024

thanks @macdonst
glad to hear that you reproduce this on iOS9 !!!

from phonegap-plugin-push.

wakeupmh avatar wakeupmh commented on July 20, 2024

Yes @ bau720123 , I use deviceready trigger , Can I use another way to show an alert with my registration key ?, I just wanna a test with this plugin, because when i called the function it does not show anything to me in app build

from phonegap-plugin-push.

bau720123 avatar bau720123 commented on July 20, 2024

hi @wakeupmh
android or ios ?
version ?
are you sure the plugin install correct ?
PGB version ?

from phonegap-plugin-push.

wakeupmh avatar wakeupmh commented on July 20, 2024

hello @bau720123, In a first moment this app is only for Android version:4.4.2. I'm using a PGB without interface, directly on Sublime text for example, so I only included this following tag: <gap:plugin name="phonegap-plugin-push" source="npm" /> in my config.xml. I'm using phonegap/cordova CLI 5.2.

from phonegap-plugin-push.

bau720123 avatar bau720123 commented on July 20, 2024

hi @wakeupmh
what tag ?
I can't see it...

from phonegap-plugin-push.

wakeupmh avatar wakeupmh commented on July 20, 2024

sorry, this tag: gap:plugin name="phonegap-plugin-push" source="npm"

from phonegap-plugin-push.

bau720123 avatar bau720123 commented on July 20, 2024

hi @wakeupmh
if you are using PGB (build.phonegap.com)
please use 1.2.3 version for now

<gap:plugin name="phonegap-plugin-push" source="npm" version="1.2.3" />

and...if you have other question
please reopen a new one
because this article topic is "rigger twice times" problem
thanks

from phonegap-plugin-push.

fredgalvao avatar fredgalvao commented on July 20, 2024

@bau720123, @wakeupmh There is not need to specify 1.2.3 for PhonegapBuild anymore. See the README.

from phonegap-plugin-push.

bau720123 avatar bau720123 commented on July 20, 2024

hi @fredgalvao
I know PGB support gradle build for now
but look at this
http://community.phonegap.com/nitobi/topics/gradle-support-enabled-for-android-builds
I am "ColinBau"

so...I suggest if you are using PGB,1.2.3 version for now

from phonegap-plugin-push.

fredgalvao avatar fredgalvao commented on July 20, 2024

I see... that's bad news huh.

Well, might as well mention that it's a temporary workaround, so people don't stick with older versions of the plugin unnecessarily.

from phonegap-plugin-push.

macdonst avatar macdonst commented on July 20, 2024

@bau720123 can you test with the code that is currently in master? I've merged PR #215 that fixes the issue with the local notifications plugin and I believe it also takes care of this double registration problem. It removes an unnecessary call to registerForRemoteNotifications which could cause the double registration event. Now, I can no longer reproduce the issue.

from phonegap-plugin-push.

bau720123 avatar bau720123 commented on July 20, 2024

hi @macdonst
so you want me to readd the plugin again and test with this situation ? (double registration problem)

cordova plugin add https://github.com/phonegap/phonegap-plugin-push
or
cordova plugin add "phonegap-plugin-push"

from phonegap-plugin-push.

macdonst avatar macdonst commented on July 20, 2024

Try the

cordova plugin add https://github.com/phonegap/phonegap-plugin-push

Method as it will get the latest code.

On Oct 10, 2015 20:13, "包四維" [email protected] wrote:

hi @macdonst https://github.com/macdonst
so you want me to readd the plugin again and test with this situation ?

cordova plugin add https://github.com/phonegap/phonegap-plugin-push
or
cordova plugin add "phonegap-plugin-push"


Reply to this email directly or view it on GitHub
#57 (comment)
.

from phonegap-plugin-push.

bau720123 avatar bau720123 commented on July 20, 2024

hi @macdonst
the issue seem solved
thanks

from phonegap-plugin-push.

macdonst avatar macdonst commented on July 20, 2024

Closing as per @bau720123

from phonegap-plugin-push.

19akash91 avatar 19akash91 commented on July 20, 2024

hi @bau720123 sir
i am added cordova plugin add "phonegap-plugin-push" this plugin but not call registration method and error method plz help me

code is here :

var push = PushNotification.init({
android: {
senderID: "*********"
},
ios: {
alert: "true",
badge: "true",
sound: "true"
},
windows: {}
});
//alert("push is : "+push);
//var push = Scopes.get('push');
push.on('registration', function(data) {alert("in push registration");
device=data.registrationId;
localStorage.setItem('device_id',device);
alert("device id is : "+localStorage.getItem('device_id'));
});
push.on('notification', function(data) {
});
push.on('error', function(e) {
// e.message
alert("ErrorCallback "+e.message);
});
}

from phonegap-plugin-push.

lock avatar lock commented on July 20, 2024

This thread has been automatically locked.

from phonegap-plugin-push.

Related Issues (20)

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.