gpt4 book ai didi

java - 无法使用 DBX 选择器错误创建链接 android

转载 作者:行者123 更新时间:2023-12-01 04:23:51 25 4
gpt4 key购买 nike

我正在尝试将 Dropbox 选择器插入式 API 集成到我的应用程序中。我遇到了一个不正常的问题。在我的应用程序中,当我启动 dbx 选择器时,每当我选择文件时,应用程序都会失败,并显示以下错误代码:

Sorry, an error has occurred. Please try again later.

这是我实现 Dropbox API 的代码部分。这部分代码是最初调用 dropbox api 的地方。

public void StartDropboxApplication() {
// create the chooser
DbxChooser chooser = new DbxChooser(APP_KEY);

DbxChooser.ResultType result;

// determine which mode to be in // TODO REMOVE ALL BUT FILE CONTENT TODO SIMPLIFY by making this a setting
switch(( (RadioGroup) ParentActivity.findViewById(R.id.link_type)).getCheckedRadioButtonId() ) {
case R.id.link_type_content:
result = DbxChooser.ResultType.DIRECT_LINK;
break;
default:
throw new RuntimeException("Radio Group Related error.");
}

// launch the new activity
chooser.forResultType(result).launch(ParentActivity, 0);
}

这是代码应该拾取它的位置,尽管它从来没有这样做。

protected void onActivityResult( int request, int result, Intent data ) {
Log.i(fileName, "result: " + result);

// check to see if the camera took a picture
if (request == 1) {
// check to see if the picture was successfully taken
if (result == Activity.RESULT_OK) {
onPicture();
} else {
Log.i(fileName, "Camera App cancelled.");
}
} else if (request == 0) {
if ( result == Activity.RESULT_OK ) {
onDropbox(data);
} else {
Log.i(fileName, "dropbox related issue.");
}
}
}

感谢您提供的任何帮助或建议。

最佳答案

我能够解决自己的问题并使其正常运行。如果其他人也有类似的问题,我将详细说明解决方案。 第一个问题是我的 APP_KEY 不正确。

下一个问题是我尝试从直接链接而不是内容链接读取。直接链接为应用程序提供了 Dropbox 服务器上文件的链接,而内容链接为应用程序提供了文件的缓存版本。如果设备上不存在该文件,SDK 会为您下载一个副本。

关于java - 无法使用 DBX 选择器错误创建链接 android,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18679225/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com