我想创建一个Android应用程序,需要使用OAuth认证(与谷歌Wave数据API)
I'm trying to create an Android app that needs to use OAuth to authenticate (with the Google Wave data API)
我指定我的AndroidManifest.xml
,以便任何意见,以一个URL开始题库://自定义方案应该去我的应用程序:
I've specified a custom scheme in my AndroidManifest.xml
so that any views to a url beginning "braindump://" should go to my app:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.enigmagen.braindump"
android:versionName="0.1"
android:versionCode="1">
<uses-sdk android:minSdkVersion="7"></uses-sdk>
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<application
android:icon="@drawable/icon"
android:label="@string/app_name"
android:debuggable="true">
<activity
android:name=".BrainDump"
android:label="@string/app_name"
android:launchMode="singleInstance">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="braindump" />
</intent-filter>
</activity>
</application>
</manifest>
所有这一切发生的是,虽然重定向后,在浏览器的地址显示了正确的URL,但页面内容
All that happens though is that after the redirect, the browser address shows the correct URL, but the page content is
您没有权限打开此页面。 题库:// rest_of_address_here
You do not have permission to open this page. braindump://rest_of_address_here
有没有需要被设置为允许这种行为的特定权限?
Is there a specific permission that needs to be set to allow this sort of behaviour?
我有完全相同的问题(的OAuth),而且这是我的固定它。
I had the exact same problem (OAuth) and this is how I fixed it.
我已经分开我主要从将作用于URI的类。
I've separated my Main from the class that will act on the URI.
这里是AndroidManifest.xml中应该是什么样子:
Here's how the AndroidManifest.xml should look like:
<?xml version="1.0" encoding="utf-8"?>
[snip]
<activity android:label="@string/app_name" android:name="MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:label="@string/app_name" android:name="OAUTHActivity">
<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="myscheme" android:host="oauth" />
</intent-filter>
</activity>
</application>
[/snip]
和我能打开的URI像 myscheme // OAuth的oauth_verifier = XXX和放大器; oauth_token = YYY
And I was able to open URIs like myscheme//oauth?oauth_verifier=xxx&oauth_token=yyy
上一篇:复合属性属性
下一篇:如何播放没有文件?文件