Skip to content
This repository has been archived by the owner on Sep 4, 2020. It is now read-only.

iOS asks for autorisation before init() is called #49

Closed
martinfilliau opened this issue Jul 28, 2015 · 10 comments
Closed

iOS asks for autorisation before init() is called #49

martinfilliau opened this issue Jul 28, 2015 · 10 comments

Comments

@martinfilliau
Copy link

Immediately after our application starts, the iOS window "X would like to send you push notifications", yet before the init method of the push plugin is called.

We would like to defer the initial demand to be aligned with the call to init so that users are not immediately asked if they want to receive push notifications (research shows that people are less inclined to accept if they don't know what it is for, e.g. http://techcrunch.com/2014/04/04/the-right-way-to-ask-users-for-ios-permissions/)

Not sure to exactly understand how everything is happening in AppDelegate, any idea on this?

@macdonst macdonst added this to the Release 1.2.0 milestone Jul 28, 2015
@macdonst
Copy link
Member

@martinfilliau You are not wrong. In fact I remember reading this article and referencing it as best practices during one of my presentations. I will look into fixing it for the 1.2.0 release.

@KeKs0r
Copy link

KeKs0r commented Jul 29, 2015

I was also wondering, because I was heavily investing of delaying the init calls, just to find out that the permissions are directly asked for.

So big +1 for this.

@macdonst
Copy link
Member

macdonst commented Aug 5, 2015

@martinfilliau can you give me a bare bones .js file that reproduces the problem because I can't. If I put the code that calls PushNotification.init() in an onClick handler of a button then I don't get the pop up dialog until I actually click the button. So it is working as I'd expect it.

You can see my gist here: https://gist.github.com/macdonst/6675af8186c9a6468f25

@martinfilliau
Copy link
Author

@macdonst sorry for long delay in answer.

I have just used your gist and the plugin version 1.1.1 and I am being asked about allowing push notifications before clicking on the "GO" button (which refers to mybutton in your index.js). The dialog appears just after the app starts.

fichier 24-08-2015 14 15 34

We use Phonegap Build and the only plugins installed are:

<gap:plugin name="org.apache.cordova.statusbar" version="0.1.10" source="plugins.cordova.io"/
<gap:plugin name="phonegap-plugin-push" source="npm" version="1.1.1" />
<gap:plugin name="cordova-plugin-whitelist" source="npm" version="1.0.0" />

I had resetted my push notification settings using the procedure as described in https://developer.apple.com/library/ios/technotes/tn2265/_index.html#//apple_ref/doc/uid/DTS40010376-CH1-TNTAG42

I have an iPhone 5S running iOS 8.4.1.

@macdonst macdonst modified the milestones: Release 1.3.0, Release 1.2.0 Aug 25, 2015
@ptarjan
Copy link

ptarjan commented Sep 2, 2015

+1

I can't migrate from PushPlugin until this is resolved

@macdonst
Copy link
Member

macdonst commented Sep 3, 2015

@ptarjan Can you reproduce the issue as well? I have not been able to so I can't fix it until I can. I'm surprised that it works differently than the old PushPlugin because same code base.

@ptarjan
Copy link

ptarjan commented Sep 3, 2015

@macdonst I didn't repo it, I just saw the issue and decided not to migrate. I'll try to migrate again when I get some time.

@macdonst macdonst modified the milestones: Release 1.3.0, Release 1.4.0 Sep 22, 2015
@martinfilliau
Copy link
Author

@ptarjan have you been able to test this plugin regarding this issue?

@ptarjan
Copy link

ptarjan commented Sep 29, 2015

@martinfilliau thanks for cycling back to me. Yes, I have migrated and the dialog appears in the right place. Mark as resolved please.

@lock
Copy link

lock bot commented Jun 5, 2018

This thread has been automatically locked.

@lock lock bot locked as resolved and limited conversation to collaborators Jun 5, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

No branches or pull requests

4 participants