This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.example.direct_reply_notification | |
| import android.app.NotificationChannel | |
| import android.app.NotificationManager | |
| import android.content.Context | |
| import android.graphics.Color | |
| import android.os.Build | |
| import androidx.core.app.NotificationManagerCompat | |
| object NotificationHelper { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.example.direct_reply_notification | |
| import android.os.Bundle | |
| import io.flutter.embedding.android.FlutterActivity | |
| class MainActivity: FlutterActivity() { | |
| override fun onCreate(savedInstanceState: Bundle?) { | |
| super.onCreate(savedInstanceState) | |
| NotificationHelper.createChannel(this) // call create channel from onCreate | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.example.direct_reply_notification | |
| import android.app.Notification | |
| import android.app.NotificationChannel | |
| import android.app.NotificationManager | |
| import android.app.PendingIntent | |
| import android.content.Context | |
| import android.content.Intent | |
| import android.graphics.Color | |
| import android.os.Build |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.example.direct_reply_notification | |
| import android.os.Bundle | |
| import io.flutter.embedding.android.FlutterActivity | |
| class MainActivity: FlutterActivity() { | |
| override fun onCreate(savedInstanceState: Bundle?) { | |
| super.onCreate(savedInstanceState) | |
| NotificationHelper.createChannel(this) | |
| NotificationHelper.showNotification(this) // show notification on create |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.example.direct_reply_notification | |
| import android.content.BroadcastReceiver | |
| import android.content.Context | |
| import android.content.Intent | |
| import android.util.Log | |
| import androidx.core.app.RemoteInput | |
| class NotificationReceiver : BroadcastReceiver() { | |
| override fun onReceive(context: Context, intent: Intent) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.example.direct_reply_notification | |
| import android.content.BroadcastReceiver | |
| import android.content.Context | |
| import android.content.Intent | |
| import android.util.Log | |
| import androidx.core.app.RemoteInput | |
| class NotificationReceiver : BroadcastReceiver() { | |
| override fun onReceive(context: Context, intent: Intent) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| </activity> | |
| <!-- add the line below to register receiver --> | |
| <receiver android:name=".NotificationReceiver"/> | |
| </application> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.example.direct_reply_notification | |
| import io.flutter.embedding.engine.FlutterEngine | |
| import io.flutter.plugin.common.MethodChannel | |
| object NativeMethodChannel { | |
| private const val CHANNEL_NAME = "channel" | |
| private lateinit var methodChannel: MethodChannel | |
| fun configureChannel(flutterEngine: FlutterEngine) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.example.direct_reply_notification | |
| import android.os.Bundle | |
| import io.flutter.embedding.android.FlutterActivity | |
| import io.flutter.embedding.engine.FlutterEngine | |
| class MainActivity: FlutterActivity() { | |
| override fun configureFlutterEngine(flutterEngine: FlutterEngine) { | |
| super.configureFlutterEngine(flutterEngine) | |
| NativeMethodChannel.configureChannel(flutterEngine) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'package:flutter/services.dart'; | |
| class FlutterMethodChannel { | |
| static const channelName = 'channel'; // this channel name needs to match the one in Native method channel | |
| MethodChannel methodChannel; | |
| static final FlutterMethodChannel instance = FlutterMethodChannel._init(); | |
| FlutterMethodChannel._init(); | |
| void configureChannel() { |
OlderNewer