kyt*_*twb 12 android android-manifest android-intent
我已经坚持了好几个小时,因为之前的事情正在发挥作用,但突然停止了,表现得像预期的那样.我真的不知道如何以及为什么我在这个过程中重新检查每一行代码而不能看到什么是错的,所以我要求你们帮忙.
好的.所以我LoginScreen有一个按钮开始新Intent.ACTION_VIEW的点击活动.这将在浏览器中启动OAUTH进程,并ApiManager.OAUTH_CALLBACK_URI设置为stjapp://oauthresponse.
这是我AndroidManifest.xml参与此活动的部分:
<activity
android:name=".LoginScreen"
android:label="@string/application"
android:launchMode="singleTask">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</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="stjapp" android:host="oauthresponse" />
</intent-filter>
</activity>
Run Code Online (Sandbox Code Playgroud)
我如何开始Intent.ACTION_VIEW我的活动:
private View.OnClickListener loginHandler = new View.OnClickListener() {
public void onClick(View v) {
OAuthClientRequest request = null;
try {
request = OAuthClientRequest
.authorizationLocation(ApiManager.OAUTH_AUTHORIZE)
.setClientId(ApiManager.CLIENT_ID).setRedirectURI(ApiManager.OAUTH_CALLBACK_URI)
.buildQueryMessage();
}
catch (OAuthSystemException e) { e.printStackTrace(); }
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(request.getLocationUri() + "&response_type=code"));
startActivity(intent);
}
};
Run Code Online (Sandbox Code Playgroud)
这是浏览器中发生的事情的屏幕截图:

在那里,我应该回到我的LoginScreen活动并处理方法中的code查询参数onNewIntent但是......是的,事情不再按预期工作了.
任何帮助赞赏.
看起来这是一个Chromium bug.我正在使用的解决方法是RedirectURI的PHP登录页面,它通过JavaScript打开应用程序(不受该bug的影响):
<script language="javascript">
window.location = 'myscheme://myhost/?<?=$_SERVER["QUERY_STRING"]?>';
</script>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
46356 次 |
| 最近记录: |