Skip to content

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 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