Skip to content

Commit

Permalink
Merge pull request arnesson#642 from arnesson/revert-603-oreo-notific…
Browse files Browse the repository at this point in the history
…ation-channel-fix

Revert "Fix for required notification channel on Oreo"
  • Loading branch information
soumak77 authored Apr 15, 2018
2 parents bbfb1c0 + 8b41211 commit 89b30fc
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 19 deletions.
1 change: 0 additions & 1 deletion plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ xmlns:android="http://schemas.android.com/apk/res/android">
<receiver android:name="org.apache.cordova.firebase.OnNotificationOpenReceiver"></receiver>
</config-file>
<resource-file src="src/android/google-services.json" target="."/>
<resource-file src="src/android/cordova-plugin-firebase-strings.xml" target="res/values/cordova-plugin-firebase-strings.xml" />
<source-file src="src/android/FirebasePlugin.java" target-dir="src/org/apache/cordova/firebase" />
<source-file src="src/android/OnNotificationOpenReceiver.java" target-dir="src/org/apache/cordova/firebase" />
<source-file src="src/android/FirebasePluginInstanceIDService.java" target-dir="src/org/apache/cordova/firebase" />
Expand Down
14 changes: 1 addition & 13 deletions src/android/FirebasePluginMessagingService.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.apache.cordova.firebase;

import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
Expand All @@ -15,7 +14,6 @@
import android.content.ContentResolver;
import android.graphics.Color;

import com.asb360.area.dev.R;
import com.google.firebase.messaging.FirebaseMessagingService;
import com.google.firebase.messaging.RemoteMessage;

Expand Down Expand Up @@ -97,10 +95,8 @@ private void sendNotification(String id, String title, String messageBody, Map<S
PendingIntent pendingIntent = PendingIntent.getBroadcast(this, id.hashCode(), intent,
PendingIntent.FLAG_UPDATE_CURRENT);

String channelId = getString(R.string.default_notification_channel_id);
String channelName = getString(R.string.default_notification_channel_name);
Uri defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this, channelId)
NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this)
.setContentTitle(title)
.setContentText(messageBody)
.setVisibility(NotificationCompat.VISIBILITY_PUBLIC)
Expand Down Expand Up @@ -154,14 +150,6 @@ private void sendNotification(String id, String title, String messageBody, Map<S
}
NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);

// Since android Oreo notification channel is needed.
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
NotificationChannel channel = new NotificationChannel(channelId,
channelName,
NotificationManager.IMPORTANCE_DEFAULT);
notificationManager.createNotificationChannel(channel);
}

notificationManager.notify(id.hashCode(), notification);
} else {
bundle.putBoolean("tap", false);
Expand Down
5 changes: 0 additions & 5 deletions src/android/cordova-plugin-firebase-strings.xml

This file was deleted.

0 comments on commit 89b30fc

Please sign in to comment.