gpt4 book ai didi

android - 标准 Intent URI 损坏?

转载 作者:塔克拉玛干 更新时间:2023-11-02 20:55:48 29 4
gpt4 key购买 nike

我在特定设备上遇到了 Intent URI 的问题,所以我按照此处的建议尝试了 CommonsWare URLHandler 示例:Launching my app using the intent URI ,并且其示例页面上的 Intent URI 超链接也无法调用该应用程序。该示例声明其 intent-filter 如下:

<intent-filter>
<action android:name="com.commonsware.android.MY_ACTION" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>

示例网页中的超链接是:

<a href="intent:#Intent;action=com.commonsware.android.MY_ACTION;end">Link back to URLHandler via intent: URL</a>

这适用于大多数设备,但不适用于运行 Android 4.0.3 的 HTC Amaze 4G。当我触摸链接时,logcat 给出:

I/PRIME(9029): <CallBackProxy> Send to WebViewClient.
I/PRIME(9029): <Browser> Send to HtcLinkifyDispatcher
I/ActivityManager(262): START intent from pid 9029
D/MP-Decision(891): Aggress decision engine: Off
D/MP-Decision(891): Switch back to normal parameters:
Nw=2.700000, Tw=180, Ns=2.100000, Ts=270, Decision_ms=100, Poll_ms=10
V/NfcService(600): setForegroundNdefPush msg = null callback = null
D/HtcTelephony(561): requestSetFastDormancy: module=0 mode=0
D/WebViewTimersControl(9029): onBrowserActivityPause
D/WebViewTimersControl(9029): Pausing webview timers,
view=com.android.browser.BrowserWebView@40e562f8
I/ActivityManager(262): Start proc com.htc.HtcLinkifyDispatcher for
activity com.htc.HtcLinkifyDispatcher/.HtcLinkifyDispatcherActivity:
pid=11087 uid=1000 gids={1015, 3002, 3001, 3003, 5001, 5003, 3007, 3006, 2001, 1007}
D/ConnectivityService(262): onUidRulesChanged(uid=1000, uidRules=0)
V/browser(9029): BrowserActivity.onWindowFocusChanged
D/HtcLinkifyDispatcherActivity(11087): @@@@@ receive action=com.commonsware.android.MY_ACTION
I/HtcAppAssociationsUtils (Dispatcher)(11087): @@@@@ enable by 2 = true
I/HtcAppAssociationsUtils (Dispatcher)(11087): @@@@@ method = 0
I/HtcAppAssociationsUtils (Dispatcher)(11087): @@@@@ check enable = true
D/MP-Decision(891): Aggress decision engine: On
D/ActivityManager(262): Config after re-evaluted by window manager: null
D/MP-Decision(891): Switch to aggressive parameters:
Nw=1.990000, Tw=140, Ns=1.400000, Ts=190, Decision_ms=50, Poll_ms=10
V/browser(9029): BrowserActivity.onWindowFocusChanged
D/HtcTelephony(561): requestSetFastDormancy: module=0 mode=1
W/InputManagerService(262): Window already focused, ignoring focus gain of:
com.android.internal.view.IInputMethodClient$Stub$Proxy@40e75100
D/WebViewTimersControl(9029): onBrowserActivityResume
D/WebViewTimersControl(9029): Resuming webview timers,
view=com.android.browser.BrowserWebView@40e562f8
W/BaseUi(9029): mMainView is already attached to wrapper in attachTabToContentView!
W/BaseUi(9029): mContainer is already attached to content in attachTabToContentView!
V/NfcService(600): setForegroundNdefPush msg = null
callback = android.nfc.INdefPushCallback$Stub$Proxy@40e73470
D/memalloc(9029): /dev/pmem: Unmapping buffer base:0x569c5000 size:4386816 offset:4177920
D/browser(9029): [BrowserActivity::Connectivity_Type] ===== 1
I/ActivityManager(262): No longer want
com.htc.providers.settings:remote (pid 10935): hidden #16, adj=15
D/Process(262): killProcessQuiet, pid=10935
D/Process(262): dalvik.system.VMStack.getThreadStackTrace(Native Method)
D/ConnectivityService(262): onUidRulesChanged(uid=1000, uidRules=0)
D/Process(262): java.lang.Thread.getStackTrace(Thread.java:599)
D/Process(262): android.os.Process.killProcessQuiet(Process.java:823)
D/Process(262): com.android.server.am.ActivityManagerService.updateOomAdjLocked(ActivityManagerService.java:15132)
D/Process(262): com.android.server.am.ActivityManagerService.trimApplications(ActivityManagerService.java:15294)
D/Process(262): com.android.server.am.ActivityStack.activityIdleInternal(ActivityStack.java:3450)
D/Process(262): com.android.server.am.ActivityManagerService.activityIdle(ActivityManagerService.java:4303)
D/Process(262): android.app.ActivityManagerNative.onTransact(ActivityManagerNative.java:362)
D/Process(262): com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:1706)
D/Process(262): android.os.Binder.execTransact(Binder.java:338)
D/Process(262): dalvik.system.NativeStart.run(Native Method)

有人知道这里的 Intent URI 是怎么回事吗?为什么它无法工作?有解决方法吗?

谢谢,西蒙

最佳答案

因为我可以在 HTC One S 上重现这个问题,而我不能在其他 ICS/JB 设备上重现这个问题,我认为这是 Linkify 解决方法的另一个结果 HTC put in place in response to Apple-led litigation .

And is there a workaround?

如果您控制双方(例如,包含链接的 WebView,以及响应 intent URL 的应用),您可以手动强制选择器通过 Intent.createChooser(),这可能有效。

但是,如果您依靠第三方代码(例如 Web 浏览器)来打开您的应用程序,那么我相信您在这些 HTC 设备上就完蛋了。

关于android - 标准 Intent URI 损坏?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11780090/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com