Skip to content
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

[TIMOB-25591] Android: Programmatically check whether app has notification permission on Android. #9669

Merged
merged 12 commits into from Feb 26, 2018

Conversation

ypbnv
Copy link
Contributor

@ypbnv ypbnv commented Dec 8, 2017

JIRA: https://jira.appcelerator.org/browse/TIMOB-25591

Description:
Expose NotificationManagerCompat.areNotificationsEnabled method.

Note: Different results from this property are returned after a change has been made outside JS runtime, so maybe only check for the default value in a unit test ( I assume it is true by default )?

Test case:
app.js

Ti.API.info('Notifications are enabled - ' + Ti.Android.NotificationManager.areNotificationsEnabled());

@ypbnv ypbnv added this to the 7.1.0 milestone Dec 8, 2017
@build
Copy link
Contributor

build commented Dec 8, 2017

Messages
📖

💾 Here's the generated SDK zipfile.

Generated by 🚫 dangerJS

summary: Returns whether showing notifications is enabled for the application.
returns:
type: Boolean
since: "7.1.0"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need more parity for push notifications. Why not use remoteNotificationsEnabled?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That option will also block local notifications, so that wording would not describe it's full effect.

Copy link
Contributor

@garymathews garymathews left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CR: PASS

@ypbnv But test case needs updating due to lint errors.

@lokeshchdhry
Copy link
Contributor

lokeshchdhry commented Feb 26, 2018

FR Passed.

areNotificationsEnabled() works as expected.

  1. Notifications are enabled by default & areNotificationsEnabled() returns true.
  2. After turning off notifications in settings for the app areNotificationsEnabled() returns false.

Studio Ver: 5.0.0.201712081732
SDK Ver: 7.2.0 local build
OS Ver: 10.13.2
Xcode Ver: Xcode 9.2
Appc NPM: 4.2.12
Appc CLI: 7.0.2
Daemon Ver: 1.0.1
Ti CLI Ver: 5.0.14
Alloy Ver: 1.11.0
Node Ver: 8.9.1
NPM Ver: 5.5.1
Java Ver: 1.8.0_101
Devices: ⇨ google Nexus 6P --- Android 8.0.0
⇨ google Nexus 5 --- Android 6.0.1
Emulator: Android 4.1

@lokeshchdhry lokeshchdhry merged commit 84b1bdf into tidev:master Feb 26, 2018
@sgtcoolguy sgtcoolguy modified the milestones: 7.2.0, 7.3.0 May 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants