简体   繁体   English

框android示例代码无法正常运行

[英]Box android sample code does not run properly

This is a question for Box team, but I want to ask publicly so that others can benefit. 这是Box团队的一个问题,但我想公开询问,以便其他人可以从中受益。

As a registered developer of Box's sdk, I downloaded the sample android app from github https://github.com/box/box-android-sdk-v2 , and followed the instruction from https://developers.box.com/android-sdk-tutorial/ 作为Box sdk的注册开发人员,我从github https://github.com/box/box-android-sdk-v2下载了示例android应用,并按照https://developers.box.com/android的说明进行了操作。 -sdk-tutorial /

============= Here is what I did: =============这是我所做的:

  1. I set the following information correctly in HelloWorldApplication.java: 我在HelloWorldApplication.java中正确设置了以下信息:

public static final String CLIENT_ID = "xxxxxxx"; 公共静态最终字符串CLIENT_ID =“ xxxxxxx”;

public static final String CLIENT_SECRET = "yyyyyy"; 公共静态最终字符串CLIENT_SECRET =“ yyyyyy”;

public static final String REDIRECT_URL ="boxsdk-xxxxxxx://boxsdkoauth2redirect"; 公共静态最终字符串REDIRECT_URL =“ boxsdk-xxxxxxx:// boxsdkoauth2redirect”;

  1. Then I ran Helloworld2 from Android's eclipse. 然后,我从Android Eclipse中运行了Helloworld2。

It displays an activity for me to log in to Evernote and grant access to it. 它显示了一个活动供我登录Evernote并授予对该活动的访问权限。

  1. After I click on Grant Access, it returns me back to the main activity. 单击“授予访问权限”后,它使我返回到主要活动。

It displays the following: "failure: the protocol is not supported." 它显示以下内容:“失败:不支持该协议。”

========================== I tried to understand the error means redirect URL is not https, but I am running inside an Android App, so that is obviously not an real error. 我试图了解该错误,表示重定向URL不是https,但我在Android应用程序中运行,因此显然不是一个真正的错误。

Can someone point out a valid way to run your sample app? 有人可以指出一种运行示例应用程序的有效方法吗?

Thanks so much. 非常感谢。

Regards, Howard 问候,霍华德

I suppose the error is related to URL setting, yours is 我想该错误与URL设置有关,您的是

public static final String REDIRECT_URL ="boxsdk-xxxxxxx://boxsdkoauth2redirect"; 公共静态最终字符串REDIRECT_URL =“ boxsdk-xxxxxxx:// boxsdkoauth2redirect”;

as a comparison, my application uses below definition. 作为比较,我的应用程序使用以下定义。

public static final String REDIRECT_URL ="http://localhost"; 公共静态最终字符串REDIRECT_URL =“ http:// localhost”;

I suppose only http and https protocols are supported in OATH2 protocol, and the REDIRECT_URL should be same with the one you set on the Box Console page. 我想OATH2协议仅支持http和https协议,并且REDIRECT_URL应该与您在Box Console页面上设置的一致。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM