嗨,我跟踪fitbit文档,将fitbit集成到我的应用程序中。我的问题是,一旦我验证了应用程序,就意味着它没有将我重定向到我的andropid活动。我展示了我的密码
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String url = "https://www.fitbit.com/oauth2/authorize?response_type=code&client_id="
+ cliend id + "&redirect_uri=" + redirect_uri + "&scope=" + "activity";
Intent oauthIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
startActivity(oauthIntent);
}
});在我的名单里
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="MyExample4" />
</intent-filter>它带我到我的重定向page.Can任何人遇到这个问题,请帮助我。
发布于 2016-06-08 10:43:34
我不熟悉fitbit,但从您的代码中可以看到,我可以说您的意图过滤器还没有完成。您可能应该使意图筛选器与嵌入到身份验证URL中的redirect_uri匹配。
一旦您实现了这一点,并且用户正确地验证了身份,浏览器将导航到redirect_uri,使用正确的intent-filter,您将能够在应用程序中打开它。
守则可如下:
将redirect_uri设置为my-fitbit-app://my.fitbit.app/handle_auth
在你的intent-filter里
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="my-fitbit-app" />
<data android:host="my.fitbit.app" />
<data android:path="/handle_auth" />
</intent-filter>https://stackoverflow.com/questions/37699950
复制相似问题