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
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import android.os.Build;
import android.os.PowerManager;
import android.os.PowerManager.WakeLock;
import android.support.v4.app.NotificationManagerCompat;

import java.util.HashMap;

Expand Down Expand Up @@ -113,6 +114,12 @@ public void notify(int id, NotificationProxy notificationProxy)
}
}

@Kroll.method
public boolean areNotificationsEnabled()
{
return NotificationManagerCompat.from(TiApplication.getInstance()).areNotificationsEnabled();
}

@Override
public String getApiName()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ methods:
returns:
type: Titanium.Android.NotificationChannel

- name: areNotificationsEnabled
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.


properties:

- name: DEFAULT_ALL
Expand Down