AppGalleryConnect / agc-flutter-plugin

This repository including all of exsiting plugins of AppGallery Connect Service in Flutter.
Apache License 2.0
13 stars 5 forks source link

提个建议 #3

Open zhangruiyu opened 3 years ago

zhangruiyu commented 3 years ago

目前使用applink发现应用在后台期间,通过链接打开app无法获取参数 应该再安卓onresume的时候再次去eventSink发下新数据吧,而且flutter的MainActivity应该是singleTop

zhangruiyu commented 3 years ago

或者可以把getAppLinking时机交给开发者控制,我们可以在flutter端主动获取applinking

Mayism commented 3 years ago

@zhangruiyu 首先非常感谢您的反馈。

当前Flutter中获取AppLinking的agcAppLinking.onResolvedData方法,在Android默认的standard启动模式下,仅需要在初始化设置一次就可以,后续热启动的时候也同样会调用设置的回调。

但是对于singleTop启动模式,插件的onResolvedData接口未对onNewIntent进行有效处理,导致singleTop模式下热启动的确会存在无法获取AppLinking的问题。

考虑到Flutter平台下,singleTop是默认的启动模式。因此,我们将对该模式下的热启动问题进行优化处理,在插件的下个版本发布。

zhangruiyu commented 3 years ago

太好了 我刚才还在反馈这个问题,期待下个版本 image

zhangruiyu commented 3 years ago

@zhangruiyu 首先非常感谢您的反馈。

当前Flutter中获取AppLinking的agcAppLinking.onResolvedData方法,在Android默认的standard启动模式下,仅需要在初始化设置一次就可以,后续热启动的时候也同样会调用设置的回调。

但是对于singleTop启动模式,插件的onResolvedData接口未对onNewIntent进行有效处理,导致singleTop模式下热启动的确会存在无法获取AppLinking的问题。

考虑到Flutter平台下,singleTop是默认的启动模式。因此,我们将对该模式下的热启动问题进行优化处理,在插件的下个版本发布。

请问下个版本什么时候发布呢

zhangruiyu commented 2 years ago

已经第四季度了 请问有任何进展?

zhangruiyu commented 2 years ago

@Mayism

Mayism commented 2 years ago

@zhangruiyu 不好意思噢 版本还在开发中 暂未发布

zhangruiyu commented 2 years ago

好家伙啊,。。有大概日期吗。太久了吧,这

Mayism commented 2 years ago

@zhangruiyu 之前计划是年底 目前还不清楚哦

zhangruiyu commented 2 years ago

已经2022年了, 之前让我们用华为的东西, 我们也用了 现在一个bug要修复1年吗 发个版本更新下这么难吗

Mayism commented 2 years ago

@zhangruiyu 实在是不好意思 已经和开发再次确认了 正在评估解决方案 最快下个月出版本

huseyinerenguler commented 2 years ago

Hi @zhangruiyu

From what you said, I understood that the problem was:

While the application is close, when you click on the link, the application opens without any problems and the link parameters can be accessed. But while the application is open in the background, when the link is clicked, it redirects to the application, but the parameters cannot be accessed.

I completed the following 4 tests for this problem that I understood and I did not encounter the situation you mentioned.

  1. Tested with 1.2.0+300 version while app is not open.
  2. Tested with 1.2.0+300 version while app is open in background.
  3. Tested with 1.5.0+300 (null-safety) version while app is not open.
  4. Tested with 1.5.0+300 (null-safety) version while app is open in background.

Also I checked our demo application, and it works.

We released our new (null-safety) version 1.5.0+300 on January 24, 2022. Please test the following again, if the issue you mentioned still exists, give us more details.

  1. Update your flutter version to latest and test with 1.5.0+300 (null-safety) version.
  2. If not, use different devices. Maybe the issue is device specific.
  3. Check our demo application.
  4. Read the documentation again, maybe you missed something.
zhangruiyu commented 2 years ago

Hi @zhangruiyu

From what you said, I understood that the problem was:

While the application is close, when you click on the link, the application opens without any problems and the link parameters can be accessed. But while the application is open in the background, when the link is clicked, it redirects to the application, but the parameters cannot be accessed.

I completed the following 4 tests for this problem that I understood and I did not encounter the situation you mentioned.

  1. Tested with 1.2.0+300 version while app is not open.
  2. Tested with 1.2.0+300 version while app is open in background.
  3. Tested with 1.5.0+300 (null-safety) version while app is not open.
  4. Tested with 1.5.0+300 (null-safety) version while app is open in background.

Also I checked our demo application, and it works.

We released our new (null-safety) version 1.5.0+300 on January 24, 2022. Please test the following again, if the issue you mentioned still exists, give us more details.

  1. Update your flutter version to latest and test with 1.5.0+300 (null-safety) version.
  2. If not, use different devices. Maybe the issue is device specific.
  3. Check our demo application.
  4. Read the documentation again, maybe you missed something.

I believe that the MainActivity startup mode of flutter should be Android :launchMode="singleTop ". This is the default solution of the Flutter app, but it is written Step 8: according to the documentation. This will cause multiple startup modes. Set to singleTop, this time from background to pull up the app, agcAppLinking. OnResolvedData! . Listen ((event) does not trigger. Step 8: Android :launchMode="standard" is incorrect 我认为flutter的MainActivity启动模式应该为android:launchMode="singleTop”,这是flutter app的默认方案,但是按照文档上写成Step 8:,这样会造成启动多个. 设置成singleTop,这个时候从后台拉起app,agcAppLinking.onResolvedData!.listen((event)并不会触发. 简单来说文档上的Step 8:android:launchMode="standard" 就是错误的

zhangruiyu commented 2 years ago

I think we should provide a method for developers to call and not listen on 我认为应该提供一个方法给开发者调用,而且不是接受监听

huseyinerenguler commented 2 years ago

Hi @zhangruiyu

If you don't want multiple startup and still want to fetch the parameters from the deep link, you should make these changes to your project.

  1. Change android launch mode to singleTask.

    android:launchMode="singleTask”
  2. Add these changes to your main activity file.

    @Override
    protected void onNewIntent(@NonNull Intent intent) {
    super.onNewIntent(intent);
    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    startActivity(intent);
    finish();
    }

With these changes, if your application is open and in the background, when you click the link, the already opened instance will be active (not creating new app instance), and onResolvedData() listener will be triggered with parameters.

zhangruiyu commented 2 years ago

Hi @zhangruiyu

If you don't want multiple startup and still want to fetch the parameters from the deep link, you should make these changes to your project.

  1. Change android launch mode to singleTask.
android:launchMode="singleTask”
  1. Add these changes to your main activity file.
@Override
protected void onNewIntent(@NonNull Intent intent) {
    super.onNewIntent(intent);
    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    startActivity(intent);
    finish();
}

With these changes, if your application is open and in the background, when you click the link, the already opened instance will be active (not creating new app instance), and onResolvedData() listener will be triggered with parameters.

finish(); MainActivity will be turned off. I've set launchMode="singleTask"

zhangruiyu commented 2 years ago

image If finish is removed, there will be no callbacks while the app is in the background

zhangruiyu commented 2 years ago

@huseyinerenguler Is there any progress

zhangruiyu commented 2 years ago

@huseyinerenguler Is there any progress

zhangruiyu commented 2 years ago

@Mayism

zhangruiyu commented 2 years ago

什么鬼?没解决就关了?

huan721 commented 2 years ago

@zhangruiyu 这个issue你还有其他疑问吗?

zhangruiyu commented 2 years ago

按照上面说的,没法实现

zhangruiyu commented 2 years ago

Screenshot_20220610_150838_com.github.android.jpg 上面说的就非常对了,但是@huseyinerenguler 的根本不合理