flutter-zendesk icon indicating copy to clipboard operation
flutter-zendesk copied to clipboard

Chat doesn't open on android

Open faldunate opened this issue 5 years ago • 6 comments

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');
    });
  },
) 

faldunate avatar Apr 20 '20 18:04 faldunate

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.

ayaremin avatar May 30 '20 21:05 ayaremin

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?

abejr avatar Jun 18 '20 01:06 abejr

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?

lkettwig avatar Aug 25 '20 03:08 lkettwig

I couldn't make this plugin work so I end up using a plugin named https://github.com/ChangeFinance/zendesk-flutter-plugin

abejr avatar Aug 27 '20 04:08 abejr

@faldunate please retry using version 2.0.0.

ened avatar Oct 31 '20 07:10 ened

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

lkettwig avatar Nov 02 '20 17:11 lkettwig