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

Update LocalNotifications.java #19

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ithubdeveloper
Copy link

Fix Android Oreo issue.

Description

Related Issue

Motivation and Context

How Has This Been Tested?

Screenshots (if appropriate):

Types of changes

  • [1 ] Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@macdonst
Copy link
Member

@maverickmishra can you review this PR, merge it and release a new version of the plugin if everything looks good?

String title = args.getString(0);
String dir = args.getString(1);
String lang = args.getString(2);
String body = args.getString(3);
String tag = args.getString(4);
String icon = args.getString(5);

String NOTIFICATION_CHANNEL_ID = "my_channel_id_01";
Copy link
Member

Choose a reason for hiding this comment

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

This string is not used

@maverickmishra
Copy link
Member

@ithubdeveloper You will need to change the version of android here : https://github.com/ithubdeveloper/phonegap-plugin-local-notification/blob/patch-1/plugin.xml#L18

to :

<framework src="com.android.support:support-v13:26+"/>

NotificationCompat.Builder mBuilder = null;
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
int importance = NotificationManager.IMPORTANCE_DEFAULT;
NotificationChannel notificationChannel = new NotificationChannel("ID", "Name", importance);
Copy link

Choose a reason for hiding this comment

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

The channel should be named differently. Maybe id="default" and name="Default"? Also, just use NotificationManager.IMPORTANCE_DEFAULT directly here rather than creating the importance variable.


// Build notifications
NotificationCompat.Builder mBuilder =
new NotificationCompat.Builder(context)
mBuilder = mBuilder
Copy link

Choose a reason for hiding this comment

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

No need for the mBuilder = here

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

Successfully merging this pull request may close these issues.

4 participants