Comments (38)
@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.
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.
@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.
hi @macdonst
problem solved (so strange...)
anyway ~ thanks
from phonegap-plugin-push.
@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.
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.
no unfortunately not :-(. Still investigating...
from phonegap-plugin-push.
hi @Mojo90
how about paste your full code here
from phonegap-plugin-push.
@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.
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.
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.
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.
@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.
got it
thanks @Mojo90
I will try delete the "Local Notification" first to see if anything change
feedback later...
from phonegap-plugin-push.
hi @Mojo90
just like you said
is the "the "Local Notification" problem
thanks a lot
from phonegap-plugin-push.
@bau720123 No problem. If you fixed it please let me know. But at the moment I just ignore...
from phonegap-plugin-push.
hi @Mojo90 and @macdonst
I notice that the problem is not "Local Notification"
for now I am just using core plugin + push plugin
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.
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.
Hi @bau720123 , I have tested your code, but in my app it doesn't works, Can you help me ?
from phonegap-plugin-push.
@bau720123 Yeah, I've been able to reproduce this on an iOS9 device as well.
from phonegap-plugin-push.
hi @wakeupmh
is your deviceready trigger ?
please confirm this first
from phonegap-plugin-push.
thanks @macdonst
glad to hear that you reproduce this on iOS9 !!!
from phonegap-plugin-push.
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.
hi @wakeupmh
android or ios ?
version ?
are you sure the plugin install correct ?
PGB version ?
from phonegap-plugin-push.
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.
hi @wakeupmh
what tag ?
I can't see it...
from phonegap-plugin-push.
sorry, this tag: gap:plugin name="phonegap-plugin-push" source="npm"
from phonegap-plugin-push.
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.
@bau720123, @wakeupmh There is not need to specify 1.2.3 for PhonegapBuild anymore. See the README.
from phonegap-plugin-push.
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.
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.
@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.
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.
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.
hi @macdonst
the issue seem solved
thanks
from phonegap-plugin-push.
Closing as per @bau720123
from phonegap-plugin-push.
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.
This thread has been automatically locked.
from phonegap-plugin-push.
Related Issues (20)
- Callbacks (hasPermission, register) are not called on iOs 13 HOT 3
- @parmarkaushik15 yeah, like I said in my last comment, if the app is forced closed there is no web view in memory to run the JS. The best you can do at this point is look into using the force start parameter. HOT 1
- ios: notification event not firing after app is closed when user opens app directly - works on android HOT 1
- On notification event not firing when cordova local notification plugin is installed. HOT 5
- IOS. Does not show 'Allow / Deny' notification dialog and not receiving push notification
- Blank screen is displayed in few devices instead of picture
- iOS13 APNS Device Token HOT 2
- getNotificationSettingsWithCompletionHandler - completion handler never executes on iOS 9.3.5
- Incompatibilty phonegap-plugin-push whit cordova-plugin-googlemaps HOT 5
- Unable to send push to browser(Firefox, Chrome) using fcm/gcm getting 'InvalidRegistration'
- On Android it receives notifications but they don't appear on Firebase Analytics
- Not every key in the firebase's {android/ios}.notification object is supported in "additionalData" object
- Unable to compile 2.3.0
- HELP - Failed to install 'phonegap-plugin-push': undefined - cocoapods -macOs Catalina HOT 1
- registration is not called
- iOS: Can't process background notification on low battery
- Security Error with android:exported=true
- [Android] on('notification') 'coldstart' value is acting wacky and not as documented (works only on iOS)
- Sporadic registrations on iOS using Xcode
- FCM version is not up-to-date.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from phonegap-plugin-push.