ConnectyCube / connectycube-flutter-call-kit

A Flutter plugin for displaying call screen when the app in the background or terminated.
https://developers.connectycube.com/flutter
Apache License 2.0
55 stars 75 forks source link

flutter - connectycube_flutter_callkit Accept button launches the app in terminated mode instead of executing the method inside #85

Closed alito0697 closed 5 months ago

alito0697 commented 1 year ago

Open when i click on the accept button it launches the app instead of executing the method inside when app is in the background but it works in the foreground

TatankaConCube commented 1 year ago

it is unusual using of the plugin. if you don't want to run the application by clicking on the Accept button you can modify the plugin according to your needs. There the code what runs the app.

alito0697 commented 1 year ago

how can i change it please explain more with code i'll be gratefull here is the method that i want to run when i click on the accept button

joinmeeting(var name);

TatankaConCube commented 1 year ago

as I understand, the method joinmeeting(var name); is a part of your app and you can call it from the onCallAccepted callback or from the onCallAcceptedWhenTerminated callback. If you don't wan to launch the app by the Accept action you just can comment next lines.

alito0697 commented 1 year ago

i commented the three lines i ran flutter clean but still not working. any ideas ??

TatankaConCube commented 1 year ago

could you please specify what means still not working? Does the app start anyway by clicking on the Accept button?

alito0697 commented 1 year ago

Yes it still launches the app

TatankaConCube commented 1 year ago

could you please provide your pubspec.yaml file with the locally connected connectycube-flutter-call-kit plugin?

alito0697 commented 1 year ago

here is the pubspec.yaml :

`name: consisty description: A new Flutter project.

The following line prevents the package from being accidentally published to

pub.dev using flutter pub publish. This is preferred for private packages.

publish_to: 'none' # Remove this line if you wish to publish to pub.dev

The following defines the version and build number for your application.

A version number is three numbers separated by dots, like 1.2.43

followed by an optional build number separated by a +.

Both the version and the builder number may be overridden in flutter

build by specifying --build-name and --build-number, respectively.

In Android, build-name is used as versionName while build-number used as versionCode.

Read more about Android versioning at https://developer.android.com/studio/publish/versioning

In iOS, build-name is used as CFBundleShortVersionString while build-number is used as CFBundleVersion.

Read more about iOS versioning at

https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html

In Windows, build-name is used as the major, minor, and patch parts

of the product and file versions while build-number is used as the build suffix.

version: 1.0.0+1

environment: sdk: '>=2.18.2 <4.0.0'

Dependencies specify other packages that your package needs in order to work.

To automatically upgrade your package dependencies to the latest versions

consider running flutter pub upgrade --major-versions. Alternatively,

dependencies can be manually updated by changing the version numbers below to

the latest version available on pub.dev. To see which dependencies have newer

versions available, run flutter pub outdated.

dependencies: flutter_native_splash: ^2.1.3 agora_rtc_engine: ^5.3.0 permission_handler: ^8.1.5 flutter_ringtone_player: ^3.2.0 wakelock: ^0.6.2 shared_preferences: ^2.0.15 flutter: sdk: flutter flutterfire_cli: ^0.2.4

# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.

cupertino_icons: ^1.0.2 http: ^0.13.4 socket_io_client: ^2.0.0 image_picker: ^0.8.6 image_cropper: ^3.0.1 jitsi_meet: ^4.0.0

flutter_callkit_incoming: ^1.0.2+2

connectivity_plus: ^2.3.6+1 firebase_messaging: ^13.0.0 firebase_core: ^1.22.0 notification_permissions: ^0.6.1 awesome_notifications: ^0.7.2 connectycube_flutter_call_kit: ^2.2.1 uuid: ^3.0.7 get: ^4.6.5 get_it: ^7.2.0 background_fetch: ^1.1.4

flutter_native_splash:

#color: "#ffffff"
#image: images/capture.png

# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.

dev_dependencies: flutter_test: sdk: flutter

The "flutter_lints" package below contains a set of recommended lints to

For information on the generic Dart part of this file, see the

following page: https://dart.dev/tools/pub/pubspec

The following section is specific to Flutter packages.

flutter:

The following line ensures that the Material Icons font is

included with your application, so that you can use the icons in

the material Icons class.

uses-material-design: true

To add assets to your application, add an assets section, like this:

assets:

- images/a_dot_burr.jpeg

- images/a_dot_ham.jpeg

An image asset can refer to one or more resolution-specific "variants", see

https://flutter.dev/assets-and-images/#resolution-aware

For details regarding adding assets from package dependencies, see

https://flutter.dev/assets-and-images/#from-packages

To add custom fonts to your application, add a fonts section here,

in this "flutter" section. Each entry in this list should have a

"family" key with the font family name, and a "fonts" key with a

list giving the asset and other descriptors for the font. For

example:

fonts:

- family: Schyler

fonts:

- asset: fonts/Schyler-Regular.ttf

- asset: fonts/Schyler-Italic.ttf

style: italic

- family: Trajan Pro

fonts:

- asset: fonts/TrajanPro.ttf

- asset: fonts/TrajanPro_Bold.ttf

weight: 700

#

For details regarding fonts from package dependencies,

see https://flutter.dev/custom-fonts/#from-packages

`

TatankaConCube commented 1 year ago

connectycube_flutter_call_kit: ^2.2.1

it means that the plugin connected from the pub.dev repo, use the next code for connecting the plugin locally:

  connectycube_flutter_call_kit:
    path: ../../connectycube_flutter_call_kit
alito0697 commented 1 year ago

i commented the three lines and still the same issue

here is the changes that i did in the pubspec.yaml: connectycube_flutter_call_kit: path: connectycube-flutter-call-kit-master

here is the path :

git1

btw i triggered connectycube call by fcm

TatankaConCube commented 1 year ago

I have no ideas why it doesn't work on your side. Try to search in this project where else is using the function getLaunchIntent and try to comment it there.

alito0697 commented 1 year ago

Okay tnxxx

alito0697 commented 1 year ago

i will show you my code if you notice something wrong please tell me

` Future caller() async{ await Firebase.initializeApp(); Uuid uuid = Uuid(); SharedPreferences prefs = await SharedPreferences.getInstance(); dynamic username = prefs.getString("username"); CallEvent callEvent = CallEvent(sessionId: uuid.v4() ,callType: 0, callerId: 2, callerName: username, opponentsIds:{1234});

Future<void> _onCallAccepted(CallEvent callEvent) async {
  _joinMeetingCall();

}

Future _onCallRejected(CallEvent callEvent) async {

} Future onCallRejectedWhenTerminated(CallEvent? callEvent) async { print("reject call"); } Future onCallAcceptedWhenTerminated(CallEvent callEvent) async { _joinMeetingCall();

} ConnectycubeFlutterCallKit.onCallRejectedWhenTerminated = onCallRejectedWhenTerminated; ConnectycubeFlutterCallKit.onCallAcceptedWhenTerminated = onCallAcceptedWhenTerminated; ConnectycubeFlutterCallKit.instance.init( onCallAccepted: _onCallAccepted, onCallRejected: _onCallRejected, ); ConnectycubeFlutterCallKit.showCallNotification(callEvent); ConnectycubeFlutterCallKit.setOnLockScreenVisibility(isVisible: true);

}

onMessage() { var i =0; FirebaseMessaging.onMessage.listen((RemoteMessage message)async { RemoteNotification? notification = message.notification; var filter = message.data; var j = i++; if(filter["type"] == "message"){

  AwesomeNotifications().createNotification(
  content: NotificationContent(
    autoDismissible: true,
    wakeUpScreen: true,
      id: j,
      channelKey: 'basic_channel',
      title: "Phonz Call",
      body: notification?.body
  ));
} if(filter["type"] == "call"){
 caller();
}

} ); }`