flutter-zendesk
flutter-zendesk copied to clipboard
Chat doesn't open on android
The plugin works correctly in IOS, but in android it does not open the chat
Does anyone know if there's a problem with the plug-in or am I doing something wrong?
Future<void> initZendesk() async {
zendesk.init(ZendeskAccountKey, department: 'Department Name', appName: 'App').then((r) async {
print('init finished');
UserData user = await fetchUser();
zendesk.setVisitorInfo(
name: user.nickname,
email: user.email
);
}).catchError((e) {
print('failed with error $e');
});
if (!mounted) return;
}
@override
void initState() {
super.initState();
initZendesk();
if (!mounted) return;
}
FloatingActionButton(
backgroundColor: Theme.of(context).primaryColor,
child: Icon(Icons.headset_mic, color: Colors.white),
onPressed: () async {
zendesk.startChat().then((r) {
print('startChat finished');
}).catchError((e) {
print('error $e');
});
},
)
Hello @faldunate
As a very temporary solution I just forked this repo and replaced the outdated zopim libraries with new zendesk messaging and support libraries.
You can use it in your app by adding this in your pubspec.yaml
zendesk:
git:
url: https://github.com/kngfrhzs/flutter-zendesk.git
And there is one more thing. You should also add your AndroidManifest.xml file to this activity
<activity android:name="zendesk.messaging.MessagingActivity" android:theme="@style/Base.Theme.AppCompat" />
Hope this solves your problems.
Hello @kngfrhzs, I tried your solution but I'm getting: W/ActivityThread(24151): handleWindowVisibility: no activity for token android.os.BinderProxy@3b1fa69
Do you have any idea about what it is about?
I am also having an issue with this. If I include the plugin without forking, the chat opens on android. However, if I fork it into my own directory, the chat will not open on android. Is something different between master and the actual plugin 1.0.2?
I couldn't make this plugin work so I end up using a plugin named https://github.com/ChangeFinance/zendesk-flutter-plugin
@faldunate please retry using version 2.0.0.
Version 2.0.0 didn't work for me either but I ended up making changes to my application AndroidManifest and MainActivity.java that worked. Follow the instructions here for testing a plugin with v2 embedding and also look at the AndroidManifest in the example given in the plugin: https://flutter.dev/docs/development/packages-and-plugins/plugin-api-migration