Commit cd8607d6 authored by Varun Patil's avatar Varun Patil

Use common notification channel for FCM

parent aaafba43
...@@ -116,6 +116,10 @@ ...@@ -116,6 +116,10 @@
</intent-filter> </intent-filter>
</service> </service>
<meta-data
android:name="com.google.firebase.messaging.default_notification_channel_id"
android:value="@string/default_notification_channel_id"/>
</application> </application>
</manifest> </manifest>
\ No newline at end of file
...@@ -125,7 +125,7 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On ...@@ -125,7 +125,7 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
// The id of the channel. // The id of the channel.
String id = "INSTIAPP_CHANNEL"; String id = getResources().getString(R.string.default_notification_channel_id);
// The user-visible name of the channel. // The user-visible name of the channel.
CharSequence name = "InstiApp"; CharSequence name = "InstiApp";
......
...@@ -122,7 +122,7 @@ public class NotificationIntentService extends JobIntentService { ...@@ -122,7 +122,7 @@ public class NotificationIntentService extends JobIntentService {
if (timediff <= 30 && timediff > 0) { // Change this to 30*10000 for testing if (timediff <= 30 && timediff > 0) { // Change this to 30*10000 for testing
NOTIFICATION_ID = event.getEventID().hashCode(); NOTIFICATION_ID = event.getEventID().hashCode();
final NotificationCompat.Builder builder = new NotificationCompat.Builder(getApplicationContext(), "INSTIAPP_CHANNEL"); final NotificationCompat.Builder builder = new NotificationCompat.Builder(getApplicationContext(), getResources().getString(R.string.default_notification_channel_id));
builder.setContentTitle(event.getEventName()) builder.setContentTitle(event.getEventName())
.setAutoCancel(true) .setAutoCancel(true)
.setColor(getResources().getColor(R.color.colorAccent)) .setColor(getResources().getColor(R.color.colorAccent))
......
...@@ -39,4 +39,5 @@ ...@@ -39,4 +39,5 @@
<string name="drawer_open">Open the drawer</string> <string name="drawer_open">Open the drawer</string>
<string name="drawer_close">Close the drawer</string> <string name="drawer_close">Close the drawer</string>
<string name="default_notification_channel_id">INSTIAPP_NOTIFS</string>
</resources> </resources>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment