Android 使用OAuth协议浏览不需要的行为
所以我有一个使用OAuth协议进行授权操作的软件。在主菜单中,我有一个启动活动的按钮:Android 使用OAuth协议浏览不需要的行为,android,android-activity,Android,Android Activity,所以我有一个使用OAuth协议进行授权操作的软件。在主菜单中,我有一个启动活动的按钮: Intent i = new Intent(this, HattrickOAuth.class); this.startActivityForResult(i,OAUTH_ID); 在HattrickOAuth类的onCreateBundle savedInstanceState方法中,我们需要启动浏览器以将用户重定向到授权页面。我使用: Intent browser = new Intent(Intent
Intent i = new Intent(this, HattrickOAuth.class);
this.startActivityForResult(i,OAUTH_ID);
在HattrickOAuth类的onCreateBundle savedInstanceState方法中,我们需要启动浏览器以将用户重定向到授权页面。我使用:
Intent browser = new Intent(Intent.ACTION_VIEW, Uri.parse(authUrl)); browser.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
browser.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
this.startActivity(browser);
在onResume中,我完成了授权,并返回调用结果
setResult(RESULT_OK);
finish();
问题是,这将返回到浏览器,而不是菜单上。有什么我遗漏的吗?要返回,我在清单中使用以下方案:
<activity
android:label="@string/oauth_name"
android:name=".hattrick.HattrickOAuth"
android:theme="@style/MainStyle" >
<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:host="hattrick"
android:scheme="h4m-app" />
</intent-filter>
</activity>
嗨,迪耶尔,你有没有找到解决这个问题的办法。我们采取了变通办法。我会让我的同事把它贴出来。