1
我有一個針對我感興趣的MIME類型成功調用的活動。從服務器發送的內容是作爲POST結果創建的XML文檔。我試圖處理結果兩種不同的方式,我沒有運氣好的話可以:處理Android中瀏覽器POST結果的MIME類型
- 機器人:mime類型=「應用/ customapp」這樣做,我的活動運行,但URI我得到來自Intent.getData()是用於該帖子的URL。調用getContentResolver()。openInputStream()的結果爲java.io.FileNotFoundException:沒有內容提供者:http:// ....顯然,只是擊中那個URL將不起作用,因爲我沒有發佈數據。
- android:pathPattern =「。* \ custom.app」 URL的最後一段是custom.app,所以我嘗試使用路徑模式。這樣,瀏覽器嘗試下載文檔,併發生以下兩件事之一:股票瀏覽器嘗試下載「無標題」並失敗。 Opera下載文件並將其命名爲希望的文件,並提供打開文件的功能,但Opera Mini只是下載文件。
這裏是我的清單與該計劃相關的部分:
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".CustomappActivity" android:label="@string/app_name">
<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:mimeType="application/customapp" />
<data android:scheme="http" />
<data android:scheme="https" />
</intent-filter>
</activity>
</application>
我想使用第一個選項,但即使它需要的歌劇可以忍受第二,但只有當它在兩個版本的Opera中一致工作。我只是無法看到從服務器發送結果的輸入流。
更新:在股票瀏覽器方案中,下載管理器正在中止HTTP400錯誤。看起來瀏覽器忽略了這樣一個事實,即內容是POST的結果,傳遞的URL是作爲一個簡單的GET處理的。 – Earl