Comments (14)
@tuyafeng 方便提供一个测试apk给我么,就gopeed而言的话,
packageName: com.gopeed
downloadComponentName: com.gopeed.MainActivity
mainComponentName: com.gopeed.MainActivity
我修改一下,到时候提个PR上来
from gopeed.
@monkeyWie 好的,我已经把 Gopeed 加到 Via 的下载器支持列表里,你可以在 Telegram@ViaAPKs 频道下载测试包,5.5.0.b7 及之后的版本都是支持的。
from gopeed.
这个得研究一下
from gopeed.
不知道这是不是一个合理的方案。com.dv.adm 是adm的包名
from gopeed.
看了一下via的逻辑,via内部有个写死的名单,在名单里&已安装才会显示,然后有下载任务后发给指定的界面。估计得两边联调了。
from gopeed.
那我还是提供一个schema
链接,去支持第三方来接入吧
from gopeed.
adm有
<intent-filter>
<action
android:name="android.intent.action.SEND" />
<action
android:name="android.intent.action.SEND_MULTIPLE" />
<category
android:name="android.intent.category.DEFAULT" />
<data
android:mimeType="*/*" />
</intent-filter>
然后via是这样发的
public boolean m1073a(Context context, String str) {
if (this.f8020c > 0 && !TextUtils.isEmpty(str)) {
Intent intent = new Intent();
intent.addFlags(268435456);
intent.setType("text/plain");
intent.setAction("android.intent.action.SEND");
intent.putExtra("android.intent.extra.TEXT", str);
String[][] strArr = f8019b;
int i = this.f8020c;
intent.setComponent(new ComponentName(strArr[i][0], strArr[i][2]));
try {
context.startActivity(intent);
return true;
} catch (Exception e) {
e.printStackTrace();
}
}
return false;
}
from gopeed.
我是 Via 的作者,今天正好看到相关反馈,下载了 Gopeed 应用打算适配,发现无法直接接入,还需要 Gopeed 做一些额外工作。
我先来解释下 Via 的做法,Via 调用一个第三方下载器,需要这么几个定义:
- packageName: 包名
- downloadComponentName: 新建任务的 Activity 入口
- mainComponentName: 应用主 Activity 入口
对于 ADM 来说,各项定义如下:
packageName: com.dv.adm
downloadComponentName: com.dv.get.AEditor
mainComponentName: com.dv.get.Main
这也是 DearZack 所说 Via 内部有个写死名单的原因,对于不在名单中的下载器,Via 无法假定它的下载入口,所以只能事先主动适配将属性存在应用里。
monkeyWie 说的 schema 是一个好方案,很适合拿来做跨平台方案。但在 android 端,常见的做法,还是通过 Intent 调用。简单来说,Gopeed 只需要提供一个新建下载任务的 Activity 入口(当然复用 MainActivity 也是可以的),并在 Activity#onNewIntent 及 Acticity#onCreate 处理 Intent,将下载链接及其它各种参数提取出来丢给 Flutter 界面即可。
from gopeed.
@tuyafeng @DearZack 感谢两位热心的回复,由于我没有太多的安卓开发经验,有个问题咨询下。
目前我有一个MainActivity
是支持进行跳转下载的,相关代码在这里可以看到:
gopeed/ui/flutter/android/app/src/main/AndroidManifest.xml
Lines 10 to 74 in c696b59
如果我只提供这一个Activity
入口是否足够。
from gopeed.
这么做是没问题的,就是需要再在 MainActivity 里处理收到的 Intent。AndroidManifest.xml 的声明是告诉系统,应用可以处理关联的数据,但如何处理数据,需要应用在对应的 Activity(即 MainActivity)的 onNewIntent 和 onCreate 实现。
from gopeed.
from gopeed.
我看了文档了,我理解了。
我再研究一下go的开发环境,不太擅长go。
@monkeyWie 方便留个联系方式么?
from gopeed.
我看了文档了,我理解了。 我再研究一下go的开发环境,不太擅长go。 @monkeyWie 方便留个联系方式么?
@DearZack 可以加下我微信(bGl3ZWktODQ2Ng==),或者在discord联系我
from gopeed.
1.5.6 已发布
from gopeed.
Related Issues (20)
- gopeed关闭重新启动后一直卡在空白界面 HOT 2
- 已创建的任务建议增加复制magnet链接功能 HOT 2
- Network interface binding? HOT 1
- 使用Python服务接口下载短视频时遇到206响应问题 HOT 20
- 0% HOT 1
- 好像不支持断点下载? HOT 1
- 扩展插件开发 HOT 5
- 自动开始下载 HOT 1
- 下载java版本的时候会闪退,应该是bug HOT 3
- 下载进度显示有误! HOT 4
- 建议支持302重定向跳转下载 HOT 1
- 任务完成时,下载完成界面不显示任何任务 / There are no tasks in the download complete interface when the download is completed. HOT 2
- 下载.torrent或magnet时,希望添加一个【全选/取消全选】文件的复选框 HOT 1
- v1.5.9 自动下载配置无效 HOT 1
- android: 内置浏览器, 嗅探
- 下载完成后已完成列表不显示 HOT 1
- 下载列表不显示 HOT 1
- 批量操作API可以支持根据 taskId 来操作吗?目前版本的只支持根据状态来批量操作 HOT 2
- 希望托盘图标可以增加下载中的标识
- 1.5.9版本异常崩溃退出
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gopeed.