Closed alito0697 closed 5 months ago
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
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.
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);
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.
i commented the three lines i ran flutter clean but still not working. any ideas ??
could you please specify what means still not working
? Does the app start anyway by clicking on the Accept
button?
Yes it still launches the app
could you please provide your pubspec.yaml
file with the locally connected connectycube-flutter-call-kit
plugin?
here is the pubspec.yaml
:
`name: consisty description: A new Flutter project.
flutter pub publish
. This is preferred for private packages.publish_to: 'none' # Remove this line if you wish to publish to pub.dev
version: 1.0.0+1
environment: sdk: '>=2.18.2 <4.0.0'
flutter pub upgrade --major-versions
. Alternatively,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
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
#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
flutter:
uses-material-design: true
#
`
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
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 :
btw i triggered connectycube call by fcm
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.
Okay tnxxx
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
} 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();
}
} ); }`