如何使用java在android中打开自定义方案
我正在使用这个OAuth库 我已经注册了一个定制方案如何使用java在android中打开自定义方案,java,android,oauth,custom-url-protocol,Java,Android,Oauth,Custom Url Protocol,我正在使用这个OAuth库 我已经注册了一个定制方案 <activity android:name="net.openid.appauth.RedirectUriReceiverActivity"> <intent-filter> <action android:name="android.intent.action.VIEW"/> <category android:name="a
<activity android:name="net.openid.appauth.RedirectUriReceiverActivity">
<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="kronos"
android:host="oauth2"/> <!-- Redirect URI scheme -->
</intent-filter>
</activity>
它工作正常,但现在我想处理一个自定义URL,例如,“kronos://something“,到目前为止,这里有两个问题:
-能否在onActivityResult中进行处理?如何处理
-我可以在chrome中调用这个定制协议进行测试吗(比如在iOS中使用safari)
编辑:更准确地说,当用户注销以删除OAuth令牌时,我收到的是一个自定义URL
EDIT2
我在舱单上加了这个
<activity android:name=".activity_logoff">
<intent-filter>
<data android:scheme="kronos"
android:host="something"/> <!-- Redirect URI scheme -->
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
</intent-filter>
</activity>
EDIT4
我补充说
logoutIntent1.setPackage(getApplicationContext().getPackageName());
但是下一步要做什么这个
kronos://something
用于什么?它是否有身份验证响应?如果不是,那么oAuth与此无关
您即将宣布活动\注销。您只需拨打以下电话:
context.startActivity(logoutinet1)
-其中context可以是任何活动。您希望此kronos://something
用于什么?它是否有身份验证响应?如果不是,那么oAuth与此无关
您即将宣布活动\注销。您只需拨打以下电话:
context.startActivity(logoutinet1)
-其中context可以是任何活动
Uri logoutUri = Uri.parse("kronos://something");
Intent logoutIntent1 = new Intent(Intent.ACTION_VIEW,logoutUri);
logoutIntent1.setPackage(getApplicationContext().getPackageName());