Giter VIP home page Giter VIP logo

Comments (46)

SurajLad avatar SurajLad commented on August 29, 2024

@VikashIOS I am also looking for something same in my App, do you got any help with this plugin by now ?

from flutter_callkeep.

vuitv avatar vuitv commented on August 29, 2024

me too

from flutter_callkeep.

VikashIOS avatar VikashIOS commented on August 29, 2024

@SurajLad no. did anyone find any solution for this?

from flutter_callkeep.

Sartori-RIA avatar Sartori-RIA commented on August 29, 2024

same here

from flutter_callkeep.

LegionTesta avatar LegionTesta commented on August 29, 2024

same here :(

from flutter_callkeep.

ghenry avatar ghenry commented on August 29, 2024

Load the plugin in your application class.

from flutter_callkeep.

prozaklob avatar prozaklob commented on August 29, 2024

Load the plugin in your application class.

can I have a little more information for recruits? :)

from flutter_callkeep.

ghenry avatar ghenry commented on August 29, 2024

If you have already configured FCM for background messages and followed Step 2:

https://pub.dev/packages/firebase_messaging

Add an Application.java class to your app in the same directory as your MainActivity.java. This is typically found in <app-name>/android/app/src/main/java/<app-organization-path>/.

this is where you add whatever plugins you want to use in the background or native Android side. For iOS see the flutter_local_notifications project too.

For me I put the Contacts Service in there, Local Notifications and CallKeep. Then you can run things in your backgroundmessagehandler as per those docs.

Like I said, Google the ass of these questions and figure it out for yourself. It's all out there waiting for you :-)

from flutter_callkeep.

prozaklob avatar prozaklob commented on August 29, 2024

If you have already configured FCM for background messages and followed Step 2:

https://pub.dev/packages/firebase_messaging

Add an Application.java class to your app in the same directory as your MainActivity.java. This is typically found in <app-name>/android/app/src/main/java/<app-organization-path>/.

this is where you add whatever plugins you want to use in the background or native Android side. For iOS see the flutter_local_notifications project too.

For me I put the Contacts Service in there, Local Notifications and CallKeep. Then you can run things in your backgroundmessagehandler as per those docs.

Like I said, Google the ass of these questions and figure it out for yourself. It's all out there waiting for you :-)

Friend, you saved me again. I still could not figure out how to make something work in the background (in the video of the service). :D
thx

from flutter_callkeep.

ghenry avatar ghenry commented on August 29, 2024

All I ask is that you try things first, ask and then repay that help by helping others.

from flutter_callkeep.

prozaklob avatar prozaklob commented on August 29, 2024

Application.java

package by.app.name;

import android.os.Bundle;

import io.flutter.app.FlutterActivity;
import io.flutter.plugins.GeneratedPluginRegistrant;

public class MainActivity extends FlutterActivity {
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    GeneratedPluginRegistrant.registerWith(this);
  }
}

main.dart

Future<void> displayIncomingCall(BuildContext context) async {
    await CallKeep.askForPermissionsIfNeeded(context);
    final callUUID = '0783a8e5-8353-4802-9448-c6211109af51';
    final number = '+46 70 123 45 67';

    await CallKeep.displayIncomingCall(
        callUUID, number, number, HandleType.number, false);
  }

  @override
  void initState() {
    _fcm.configure(
      onMessage: (Map<String, dynamic> message) async {
        this.displayIncomingCall(context);
      },
      onLaunch: (Map<String, dynamic> message) async {
        this.displayIncomingCall(context);
      },
      onResume: (Map<String, dynamic> message) async {
        this.displayIncomingCall(context);
      },
    );
{
  "to" : "token",
  "notification" : null,
  "data" : {
    "msgBody" : "Body of your Notification",
    "msgTitle": "Title of your Notification",
    "msgId": "000001",
    "data" : "This is sample payloadData"
  }
}



Maybe I don't fully understand.

If the application is running, the call occurs.
If closed, minimized, or the screen is locked, nothing happens.

from flutter_callkeep.

ghenry avatar ghenry commented on August 29, 2024

Start simple. Read the FCM docs link and get background messages working first. Background does not fire if you use "notification" : null,, so you have to tweak your push payload as that's for a "proper" notification.

https://stackoverflow.com/a/61842562/1072411

and

firebase/flutterfire#116 (comment)
https://stackoverflow.com/questions/57851184/unhandled-exception-nosuchmethoderror-the-method-torawhandle-was-called-on-n
https://stackoverflow.com/questions/61827613/firebase-messaging-onbackgroundmessage-not-handling-notification-when-app-is-on
https://stackoverflow.com/questions/61067558/flutter-cant-use-any-plugin-in-onbackgroundmessage

Please put some effort in and google this.

from flutter_callkeep.

ghenry avatar ghenry commented on August 29, 2024

Like I said, Google the ass of these questions and figure it out for yourself. It's all out there waiting for you :-)

Friend, you saved me again. I still could not figure out how to make something work in the background (in the video of the service). :D
thx

https://stackoverflow.com/questions/61067558/flutter-cant-use-any-plugin-in-onbackgroundmessage

See ^^^^ Just google this.

from flutter_callkeep.

prozaklob avatar prozaklob commented on August 29, 2024

At the moment, messages in the background are coming, but this is only oblique FCM.
For call_keep to listen in the background too - I need to put it in application.

ok. im go read manuals ) thx

from flutter_callkeep.

ghenry avatar ghenry commented on August 29, 2024

from flutter_callkeep.

prozaklob avatar prozaklob commented on August 29, 2024

I wouldn't say you're dumb, you're just not reading the help provided or doing things step by step. Do you have background FCM working? Have you read the android connectionservice docs? Why do you want to use CallKeep? Do you understand what it's for? Have you read all the links I took time to provide? You're not asking the right questions. Lastly, these issue trackers are for bugs. Get on stackoverflow.com for basic questions. Maybe someone else will help you more but maybe you should get paid help if this is a commercial app. Thanks.

On Wed, 7 Oct 2020, 04:16 prozaklob, @.***> wrote: Maybe I'm too dumb. Through FCM I can get a simple notification in the tray, but I don't understand how I can call the call screen with buttons (answer and reject) if the application is closed or the screen is locked — You are receiving this because you commented. Reply to this email directly, view it on GitHub <#19 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABG66FGLBXV25AVWYUKL7LSJPMPVANCNFSM4OGXNETA .

I get FCM in any application state.
If it is closed, or in the background, FCM comes to tray.
I want to receive a call using sip_ua when the application is in the background or closed. By analogy with (whatsapp / telegram / viber).

For this, it seemed to me - I need to make a push notification from asterisks when I call, which will work on the phone and launch the call_keep call panel if the phone is locked / the application is closed / in the background.

I am just learning to work with flutter and work with software. The application is self-made for self-development. I am a network engineer L3 and little know programming :)

from flutter_callkeep.

ghenry avatar ghenry commented on August 29, 2024

from flutter_callkeep.

prozaklob avatar prozaklob commented on August 29, 2024

Understand. I gave you the link for background messages. You don't want a message to hit the system tray. You want to process a background data message and call displayincomingcall. Read the firebase link I gave you. It's all here. You're thinking layer 7 when you need to be at layer 2/3.

i thonk my problem not in call_keep?
not work fcm onbackgroundmessage?

from flutter_callkeep.

ghenry avatar ghenry commented on August 29, 2024

from flutter_callkeep.

prozaklob avatar prozaklob commented on August 29, 2024

Yes. it looks like it really is. I did it like this for debugging

firebaseMessaging.configure(
      onMessage: (Map<String, dynamic> message) async {
        print("test");
      },

      onResume: (Map<String, dynamic> message) async {
      print("test")

      },

      onLaunch: (Map<String, dynamic> message) async {
      print("test")
      },
    );

When the application is on the front screen and I only send DATA, everything works. When the application is in the background, or closed - the print is silent. I will sort this out.
Thx for it. :)

from flutter_callkeep.

prozaklob avatar prozaklob commented on August 29, 2024

ok. im done and get background message.

import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
import 'package:firebase_messaging/firebase_messaging.dart';
import 'package:flutter_callkeep/flutter_callkeep.dart';

var flutterLocalNotificationsPlugin = new FlutterLocalNotificationsPlugin();

void main() async {
  runApp(MyApp());
  setFirebase();
  WidgetsFlutterBinding.ensureInitialized();
  await CallKeep.setup();
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter FCM',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: MyHomePage(title: 'Flutter FCM'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);
  final String title;
  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: Text("Hello World"),
      ),
    );
  }
}

void setFirebase() {
  var initializationSettingsAndroid =
      new AndroidInitializationSettings('icon_notif');

  var initializationSettingsIOS = IOSInitializationSettings();

  var initializationSettings = InitializationSettings(
      android: initializationSettingsAndroid, iOS: initializationSettingsIOS);

  flutterLocalNotificationsPlugin.initialize(initializationSettings,
      onSelectNotification: onSelect);

  final FirebaseMessaging _firebaseMessaging = FirebaseMessaging();

  _firebaseMessaging.configure(
    onBackgroundMessage: Platform.isIOS ? null : myBackgroundMessageHandler,
    onMessage: (message) async {
      displayIncomingCall();
      print("onMessage: $message");
    },
    onLaunch: (message) async {
      print("onLaunch: $message");
    },
    onResume: (message) async {
      print("onResume: $message");
    },
  );

  _firebaseMessaging.getToken().then((String token) {
    print("Push Messaging token: $token");
    // Push messaging to this token later
  });
}

Future<void> displayIncomingCall() async {
  final callUUID = '0783a8e5-8353-4802-9448-c6211109af51';
  final number = '+46 70 123 45 67';
  await CallKeep.displayIncomingCall(
      callUUID, number, number, HandleType.number, false);
}

Future<String> onSelect(String data) async {
  print("onSelectNotification $data");
}

//updated myBackgroundMessageHandler
Future<dynamic> myBackgroundMessageHandler(Map<String, dynamic> message) async {
  print("myBackgroundMessageHandler message: $message");
  displayIncomingCall();
}
{
  "to" : "token",
  "notification" : null,
  "data" : {
    "msgBody" : "Body of your Notification",
    "msgTitle": "Title of your Notification",
    "msgId": "000001",
    "data" : "This is sample payloadData"
  }
}
I/flutter (15168): myBackgroundMessageHandler message: {data: {msgTitle: Title of your Notification, data: This is sample payloadData, msgId: 000001, msgBody: Body of your Notification}}
E/flutter (15168): [ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: MissingPluginException(No implementation found for method displayIncomingCall on channel co.doneservices/callkeep)

the truth is somewhere near... :)

from flutter_callkeep.

ghenry avatar ghenry commented on August 29, 2024

Nice work @prozaklob !!!

Load the callkeep plugin on the native Android side as per the last link I gave you already here :-)

#19 (comment)

from flutter_callkeep.

prozaklob avatar prozaklob commented on August 29, 2024

Nice work @prozaklob !!!

Load the callkeep plugin on the native Android side as per the last link I gave you already here :-)

#19 (comment)

Trying to understand how it works in flutter / java :)

from flutter_callkeep.

prozaklob avatar prozaklob commented on August 29, 2024

Application.java

import io.flutter.app.FlutterApplication;
import io.flutter.plugin.common.PluginRegistry;
import io.flutter.plugin.common.PluginRegistry.PluginRegistrantCallback;
import io.flutter.plugins.GeneratedPluginRegistrant;
import io.flutter.plugins.firebasemessaging.FlutterFirebaseMessagingService;
import co.doneservices.callkeep.CallKeepPlugin;

public class Application extends FlutterApplication
implements PluginRegistrantCallback {
   @Override
   public void onCreate() {
     super.onCreate();
     FlutterFirebaseMessagingService.setPluginRegistrant(this);
   }

   @Override
   public void registerWith(PluginRegistry registry) {
     CustomPluginRegistrant.registerWith(registry);
     CallKeepPlugin.registerWith(registry.registrarFor("co.doneservices.callkeep.CallKeepPlugin"));
   }
}

GeneratedPluginRegistrant.java
CallKeepPlugin.registerWith(registry.registrarFor("co.doneservices.callkeep.CallKeepPlugin"));

E/MethodChannel#co.doneservices/callkeep(20207): Failed to handle method call
E/MethodChannel#co.doneservices/callkeep(20207): kotlin.KotlinNullPointerException
E/MethodChannel#co.doneservices/callkeep(20207): 	at co.doneservices.callkeep.CallKeep.hasPhoneAccount(CallKeep.kt:63)
E/MethodChannel#co.doneservices/callkeep(20207): 	at co.doneservices.callkeep.CallKeep.displayIncomingCall(CallKeep.kt:182)
E/MethodChannel#co.doneservices/callkeep(20207): 	at co.doneservices.callkeep.CallKeep.onMethodCall(CallKeep.kt:72)
E/MethodChannel#co.doneservices/callkeep(20207): 	at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:233)
E/MethodChannel#co.doneservices/callkeep(20207): 	at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:85)
E/MethodChannel#co.doneservices/callkeep(20207): 	at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:692)
E/MethodChannel#co.doneservices/callkeep(20207): 	at android.os.MessageQueue.nativePollOnce(Native Method)
E/MethodChannel#co.doneservices/callkeep(20207): 	at android.os.MessageQueue.next(MessageQueue.java:335)
E/MethodChannel#co.doneservices/callkeep(20207): 	at android.os.Looper.loop(Looper.java:183)
E/MethodChannel#co.doneservices/callkeep(20207): 	at android.app.ActivityThread.main(ActivityThread.java:7656)
E/MethodChannel#co.doneservices/callkeep(20207): 	at java.lang.reflect.Method.invoke(Native Method)

:d

from flutter_callkeep.

ghenry avatar ghenry commented on August 29, 2024

from flutter_callkeep.

prozaklob avatar prozaklob commented on August 29, 2024

Looks right. Don't forget to uninstall your app and reinstall. The Android side doesn't hot reload or hot restart.

I tried it. it's still a mistake

from flutter_callkeep.

prozaklob avatar prozaklob commented on August 29, 2024

Looks right. Don't forget to uninstall your app and reinstall. The Android side doesn't hot reload or hot restart.

I updated everything, cleaned the cache, reinstalled.
There is still this error on the front screen and in the background. :(

from flutter_callkeep.

tech-instacare avatar tech-instacare commented on August 29, 2024

@prozaklob did you find any solution?

from flutter_callkeep.

prozaklob avatar prozaklob commented on August 29, 2024

@prozaklob did you find any solution?

no, I also broke the graddle :))

let me know,if u finde solution.

from flutter_callkeep.

prozaklob avatar prozaklob commented on August 29, 2024

Nice work @prozaklob !!!

Load the callkeep plugin on the native Android side as per the last link I gave you already here :-)

#19 (comment)

Master, is there something else that we did not take into account with all the topic? )))

from flutter_callkeep.

ghenry avatar ghenry commented on August 29, 2024

from flutter_callkeep.

prozaklob avatar prozaklob commented on August 29, 2024

yes. i accept premissions on app starting

    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
    <uses-permission android:name="android.permission.VIBRATE" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <uses-permission android:name="android.permission.USE_FULL_SCREEN_INTENT" />
    <uses-permission android:name="android.permission.BIND_TELECOM_CONNECTION_SERVICE"/>
    <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
    <uses-permission android:name="android.permission.CALL_PHONE" />
    <uses-feature android:name="android.hardware.camera" />
    <uses-feature android:name="android.hardware.camera.autofocus" />
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.RECORD_AUDIO" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
    <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />

:d

dsadas

from flutter_callkeep.

ghenry avatar ghenry commented on August 29, 2024

from flutter_callkeep.

prozaklob avatar prozaklob commented on August 29, 2024

Do you see the popup and slide a switch to accept in Calling Accounts?

yes.
dsada

from flutter_callkeep.

prozaklob avatar prozaklob commented on August 29, 2024

Do you see the popup and slide a switch to accept in Calling Accounts?

Perhaps I really need help on a financial basis to help resolve this issue. Discussed?

from flutter_callkeep.

ghenry avatar ghenry commented on August 29, 2024

from flutter_callkeep.

prozaklob avatar prozaklob commented on August 29, 2024

what I will do if my app is in background mode or killed or screen lock I want something like WhatsApp calling features please help someone to make it. I am getting this error when the app is in background

E/MethodChannel#co.doneservices/callkeep( 4983): Failed to handle method call
E/MethodChannel#co.doneservices/callkeep( 4983): kotlin.KotlinNullPointerException
E/MethodChannel#co.doneservices/callkeep( 4983): at co.doneservices.callkeep.CallKeep.hasPhoneAccount(CallKeep.kt:63)
E/MethodChannel#co.doneservices/callkeep( 4983): at co.doneservices.callkeep.CallKeep.displayIncomingCall(CallKeep.kt:182)
E/MethodChannel#co.doneservices/callkeep( 4983): at co.doneservices.callkeep.CallKeep.onMethodCall(CallKeep.kt:72)
E/MethodChannel#co.doneservices/callkeep( 4983): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:231)
E/MethodChannel#co.doneservices/callkeep( 4983): at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:93)
E/MethodChannel#co.doneservices/callkeep( 4983): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:642)
E/MethodChannel#co.doneservices/callkeep( 4983): at android.os.MessageQueue.nativePollOnce(Native Method)
E/MethodChannel#co.doneservices/callkeep( 4983): at android.os.MessageQueue.next(MessageQueue.java:329)
E/MethodChannel#co.doneservices/callkeep( 4983): at android.os.Looper.loop(Looper.java:142)
E/MethodChannel#co.doneservices/callkeep( 4983): at android.app.ActivityThread.main(ActivityThread.java:6375)
E/MethodChannel#co.doneservices/callkeep( 4983): at java.lang.reflect.Method.invoke(Native Method)
E/MethodChannel#co.doneservices/callkeep( 4983): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:912)
E/MethodChannel#co.doneservices/callkeep( 4983): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:802)
E/flutter ( 4983): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: PlatformException(error, null, null)
E/flutter ( 4983): #0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:569:7)
E/flutter ( 4983): #1 MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:321:33)
E/flutter ( 4983):
E/flutter ( 4983): #2 CallKeep.displayIncomingCall (package:flutter_callkeep/flutter_callkeep.dart:181:20)
E/flutter ( 4983): #3 _SplashScreenState.displayIncomingCall (package:camiotalk/pages/splash_page.dart:197:20)
E/flutter ( 4983): #4 myBackgroundMessageHandler (package:camiotalk/pages/splash_page.dart:29:26)
E/flutter ( 4983): #5 _fcmSetupBackgroundChannel. (package:firebase_messaging/firebase_messaging.dart:38:30)
E/flutter ( 4983): #6 MethodChannel._handleAsMethodCall (package:flutter/src/services/platform_channel.dart:402:55)
E/flutter ( 4983): #7 MethodChannel.setMethodCallHandler. (package:flutter/src/services/platform_channel.dart:370:54)
E/flutter ( 4983): #8 _DefaultBinaryMessenger.handlePlatformMessage (package:flutter/src/services/binding.dart:200:33)
E/flutter ( 4983): #9 _invoke3. (dart:ui/hooks.dart:303:15)
E/flutter ( 4983): #10 _rootRun (dart:async/zone.dart:1126:13)
E/flutter ( 4983): #11 _CustomZone.run (dart:async/zone.dart:1023:19)
E/flutter ( 4983): #12 _CustomZone.runGuarded (dart:async/zone.dart:925:7)
E/flutter ( 4983): #13 _invoke3 (dart:ui/hooks.dart:302:10)
E/flutter ( 4983): #14 _dispatchPlatformMessage (dart:ui/hooks.dart:162:5)
E/flutter ( 4983):

mb u finde issue?

from flutter_callkeep.

ghenry avatar ghenry commented on August 29, 2024

from flutter_callkeep.

prozaklob avatar prozaklob commented on August 29, 2024

I really don't think you've enabled the phone account permission This is what your error is trying to call. Read the code you pasted dude.

return isConnectionServiceAvailable() && telecomManager!!.getPhoneAccount(handle).isEnabled

it work when in the foreground. If disabled the phone account permission - not work on foreground.

I think somewhere I am making a mistake in adding a plugin to Application, or problems with the manifest file.

Can you give a mini-manual? I don’t think I’m exceptionally dumb, because many people have faced the problem. The project is fresh both on stackerflow and in chats, no one worked / can not help with the given plugin.

from flutter_callkeep.

ghenry avatar ghenry commented on August 29, 2024

from flutter_callkeep.

prozaklob avatar prozaklob commented on August 29, 2024

Честно говоря, я не делал этого с проектом, так что это может быть ошибкой. Я столкнулся с подобным и исправил его flutter-webrtc / callkeep # 4. Я участвую только в этом проекте, потому что хочу использовать пользовательский метод входящего отображения. Попробуйте вышеуказанный проект. У меня это работает. И прочтите эти документы, на которых основаны все версии флаттера: https://github.com/react-native-webrtc/react-native-callkeep Надеюсь, что это поможет ....

2
1
3

Application.java

package app.name;

import io.flutter.app.FlutterApplication;
import io.flutter.plugin.common.PluginRegistry;
import io.flutter.plugin.common.PluginRegistry.PluginRegistrantCallback;
import io.flutter.plugins.GeneratedPluginRegistrant;
import io.flutter.plugins.firebasemessaging.FlutterFirebaseMessagingService;
import co.doneservices.callkeep.CallKeepPlugin;
import com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin;
import io.flutter.plugins.firebasemessaging.FirebaseMessagingPlugin;



public class Application extends FlutterApplication
implements PluginRegistrantCallback {
   @Override
   public void onCreate() {
     super.onCreate();
     FlutterFirebaseMessagingService.setPluginRegistrant(this);
   }

   @Override
   public void registerWith(PluginRegistry registry) {
     FirebaseMessagingPlugin.registerWith(registry.registrarFor("io.flutter.plugins.firebasemessaging.FirebaseMessagingPlugin"));
     FlutterLocalNotificationsPlugin.registerWith(registry.registrarFor("com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin"));
     CallKeepPlugin.registerWith(registry.registrarFor("co.doneservices.callkeep.CallKeepPlugin"));
   }
 }
{
  "notification": null,
  "data": {
    "sound": "default", 
    "status": "done",
    "screen": "screenA",
    "click_action": "FLUTTER_NOTIFICATION_CLICK"
  },
  "to" : "key"

}
 @override
  void initState() {
    super.initState();
    setFirebase();
    CallKeep.askForPermissionsIfNeeded(context);
    .......
void setFirebase() {
  var initializationSettingsAndroid =
      new AndroidInitializationSettings('mipmap/ic_launcher');

  var initializationSettingsIOS = IOSInitializationSettings();

  var initializationSettings = InitializationSettings(
      android: initializationSettingsAndroid, iOS: initializationSettingsIOS);

  flutterLocalNotificationsPlugin.initialize(initializationSettings,
      onSelectNotification: onSelect);

  final FirebaseMessaging _firebaseMessaging = FirebaseMessaging();

  _firebaseMessaging.configure(
    onBackgroundMessage: Platform.isIOS ? null : myBackgroundMessageHandler,
    onMessage: (message) async {
      print("onMessage: $message");
      displayIncomingCall();
    },
    onLaunch: (message) async {
      print("onLaunch: $message");
      displayIncomingCall();
    },
    onResume: (message) async {
      print("onResume: $message");
    },
  );

  _firebaseMessaging.getToken().then((String token) {
    print("Push Messaging token: $token");
    // Push messaging to this token later
  });
}

Future<String> onSelect(String data) async {
  print("onSelectNotification $data");
}
Future<dynamic> myBackgroundMessageHandler(Map<String, dynamic> message) async {
  print("myBackgroundMessageHandler message: $message");
  displayIncomingCall();
}

Future<void> displayIncomingCall() async {
  final callUUID = '0783a8e5-8353-4802-9448-c6211109af51';
  final number = '+46 70 123 45 67';
  await CallKeep.displayIncomingCall(
      callUUID, number, number, HandleType.number, false);
}

damn...

from flutter_callkeep.

ghenry avatar ghenry commented on August 29, 2024

from flutter_callkeep.

prozaklob avatar prozaklob commented on August 29, 2024

Why two? CallKeep.displayIncomingCall

This is my typo when copying.
Edited

from flutter_callkeep.

ghenry avatar ghenry commented on August 29, 2024

from flutter_callkeep.

rekonvald avatar rekonvald commented on August 29, 2024

Hi! have you found solution? Have the same issue

from flutter_callkeep.

SagarDhiman018 avatar SagarDhiman018 commented on August 29, 2024

Hi @ALL, have anyone found solution for background issue? I'm using FCM and Agora for calling and its working fine in foreground. Thanks!

from flutter_callkeep.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.