Skip to content

ios) notification appears even in foreground mode. #873

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
laychar opened this issue Sep 26, 2018 · 12 comments
Closed

ios) notification appears even in foreground mode. #873

laychar opened this issue Sep 26, 2018 · 12 comments

Comments

@laychar
Copy link

laychar commented Sep 26, 2018

Describe the bug
notification appears even in foreground mode.

Expected behavior
when in foreground mode, I want notification not to appear.

Plugin Version
Run cordova plugin list to find out what version of cordova-plugin-firebase you are running with
2.0.1
Desktop (please complete the following information):

  • OS: [e.g. iOS] Mac OS
  • Browser [e.g. chrome, safari] safari

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6] iPhone6
  • OS: [e.g. iOS8.1] 11.0.0
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]
    I tried to modify UNNotificationPresentationOptionAlert to UNNotificationPresentationOptionNone in the nodemodules/cordova-plugin-firebase/src/ios/AppleDelegate+FirebasePlugin.m.
    But It can't solve my problem.
    And I tried to install firebase plugin using following code.
    cordova plugin add cordova-plugin-firebase --variable IOS_HIDE_FOREGROUND_NOTIFICATION ="false"
    But I just got following error.
    laychar-ui-Mac-mini:test1 lay$ sudo cordova plugin add cordova-plugin-firebase --variable IOS_HIDE_FOREGROUND_NOTIFICATION ="false"
    (node:769) UnhandledPromiseRejectionWarning: CordovaError: invalid variable format: IOS_HIDE_FOREGROUND_NOTIFICATION
    at /usr/local/lib/node_modules/cordova/src/cli.js:435:27
    at Array.forEach ()
    at cli (/usr/local/lib/node_modules/cordova/src/cli.js:431:27)
    at /usr/local/lib/node_modules/cordova/src/cli.js:203:16
    at
    at process._tickCallback (internal/process/next_tick.js:188:7)
    at Function.Module.runMain (module.js:695:11)
    at startup (bootstrap_node.js:191:16)
    at bootstrap_node.js:612:3
    (node:769) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
    (node:769) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
@briantq
Copy link
Contributor

briantq commented Sep 26, 2018

Duplicate of #817

@briantq briantq marked this as a duplicate of #817 Sep 26, 2018
@briantq briantq closed this as completed Sep 26, 2018
@laychar
Copy link
Author

laychar commented Sep 27, 2018

I read #817 but, unfortunately I can't understand #817. Which file and which part I should modify?

@briantq
Copy link
Contributor

briantq commented Sep 27, 2018

@laychar, it is not implemented yet. There is a pull request that implements the functionality but requires modifications last time I checked. There are less than 5 PRs so it should be easy to find. Follow the PR so you know what changes to make when it's merged.

@laychar
Copy link
Author

laychar commented Sep 27, 2018

Sorry, What do you mean? - it is not implemented yet.
And What is the 5 PR....?

@soumak77
Copy link
Contributor

@laychar read the thread on #835

@laychar
Copy link
Author

laychar commented Sep 27, 2018

Thanks for your advice. But I still don't know what should I do to remove notification in foreground.
#835 said.
"If you want to hide the notifications for a running in-foreground app, you have to use the option UNNotificationPresentationOptionNone.".
The problem is that I don't know how to use the option UNNotificationPresentationOptionNone.
Can you teach me?

@laychar
Copy link
Author

laychar commented Sep 27, 2018

What file and what part I should modify or add?

@soumak77
Copy link
Contributor

Check the file modifications in the PR. That shows you which line to modify in which file.

@laychar
Copy link
Author

laychar commented Sep 27, 2018

It works Thank you!

@laychar
Copy link
Author

laychar commented Sep 27, 2018

Sorry, I did mistake. I didn't call getToken.
In other words, the notification can not be hided although I followed your instruction.
Can you tell me why I can't fix my problem?

@laychar
Copy link
Author

laychar commented Sep 27, 2018

following is file which I modified.

@laychar
Copy link
Author

laychar commented Sep 27, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants