Android 2.1 图库无法向后兼容 Cupcake 版本,现在怎么办?

发布于 2024-08-29 22:24:29 字数 689 浏览 9 评论 0原文

我不知道为什么,但在 Eclair 中,默认的(非花哨的)画廊应用程序从 Cupcake 版本更改了它的 begaviour,并且它破坏了我的一个商业应用程序:-(

首先,当长按画廊并选择“ Diashow”,它不再发布一个 Intent 供任何实现 Intent 过滤器的应用程序拾取。相反,它将直接调用带有额外功能的“com.android.gallery/com.android.camera.ViewImage”。

问题:是仍然可以拦截此意图并允许用户选择我的应用程序来执行 Diashow?

其次,VIEW 意图的意图附加内容被搞乱了(无论如何在我的 2.1 版本中):而不是提供图片的 BucketId但在 2.1 中,BucketId 被移至 Intent 的 extra;但它没有传递 BUCKET_ID,而是传递未本地化的 BUCKET_DISPLAY_NAME:-/

问题:我怎样才能从 Intent 中获取唯一的 BUCKET_ID,这样我就不必使用可能不唯一的 BUCKET_DISPLAY_NAME

有没有人为这些问题提出可行的解决方案?

我认为 Android Intents 的整体理念是能够将您的应用程序与基础 Android 环境集成,但我的 2.1 构建证明这个想法仍然存在于理论领域:-(

I don't know why, but in Eclair, the default (non-fancy) gallery app changed its begaviour from the Cupcake version, and it broke one of my commercial applications :-(

Firstly, when long-pressing a gallery and choosing "Diashow", it does not publish an Intent to be picked up by any application that implements the Intent filter anymore. Instead, it will directly call "com.android.gallery/com.android.camera.ViewImage" with extras.

Question: is it still possible to intercept this intent and allow the user to choose my application to do the Diashow?

Secondly, the intent extras for the VIEW intent are messed up (in my build of 2.1 anyway): Instead of providing the BucketId of the picture in the Intent's queryparameter. But in 2.1, the BucketId is moved to the Intent's extras. Except; it is not passing the BUCKET_ID, but the unlocalized BUCKET_DISPLAY_NAME instead :-/

Question: how can I still get the unique BUCKET_ID from the intent, so that I do not have to work with a potentially non-unique BUCKET_DISPLAY_NAME?

Is there anybody out there who has come up with a working solution for these problems?

I thought the whole idea of Android Intents was to be able to integrate your applications with the base Android environment, but my build of 2.1 proves that this idea still lives in the land of Theory :-(

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

江心雾 2024-09-05 22:24:29

首先,长按图库时
而选择“Diashow”,则不
发布一个 Intent 以供接收
任何实现的应用程序
不再进行意图过滤。

该 Intent 可能不是 SDK 的一部分,这意味着您一开始就不应该依赖它。除了 Gallery 支持常见的 Intents(例如 GET_CONTENT)之外,Gallery 应用程序没有属于 SDK 的任何 Intents选择)。

问:还有可能吗
拦截此意图并允许
用户选择我的应用程序要做的事情
迪亚秀?

我当然希望不会,因为这意味着存在严重的安全漏洞。

问题:我怎样才能得到
意图中唯一的 BUCKET_ID,因此
我不必与
潜在的非唯一性
BUCKET_DISPLAY_NAME?

意图没有记录。请不要尝试使用它。您的应用程序将在某些未附带标准图库应用程序的 Android 设备上崩溃。正如您已经经历过的那样,您的应用程序将在未来版本的 Android 中崩溃。请遵循应用程序作者记录的Intents

我想到了Android的整体理念
意图是能够整合
您的应用程序与基础
安卓环境

仅当这些 Intents 被记录并得到相关应用程序作者的支持时。如果您认为可以获取在源代码或 LogCat 等中找到的随机 Intents 并使用它们,那么您就错了。

Firstly, when long-pressing a gallery
and choosing "Diashow", it does not
publish an Intent to be picked up by
any application that implements the
Intent filter anymore.

That Intent probably was not part of the SDK, meaning you should not have been relying upon it in the first place. There are no Intents for the Gallery application that are part of the SDK, other than to the extent the Gallery supports common Intents (e.g., GET_CONTENT, PICK).

Question: is it still possible to
intercept this intent and allow the
user to choose my application to do
the Diashow?

I sure hope not, because that would mean there is a serious security hole.

Question: how can I still get the
unique BUCKET_ID from the intent, so
that I do not have to work with a
potentially non-unique
BUCKET_DISPLAY_NAME?

This Intent is not documented. Please do not attempt to use it. Your application will break on some Android devices that do not ship the standard Gallery application. Your application will break in future versions of Android, as you have already experienced. Please stick to Intents that have been documented by the application's author.

I thought the whole idea of Android
Intents was to be able to integrate
your applications with the base
Android environment

Only where those Intents were documented and are supported by the authors of the application in question. If you thought that you could just grab random Intents you found in the source code or in LogCat or something, and use those, you were mistaken.

ㄖ落Θ余辉 2024-09-05 22:24:29

问:还有可能吗
拦截此意图并允许
用户选择我的应用程序要做的事情
迪亚秀?

回答你的第一个问题......但是这样,你可能需要重建你的应用程序,然后更新......

为了使其只有你的活动接收你激发的意图,请向意图添加一个额外的标志或创建你的自己的自定义操作,然后触发一个意图。
接收活动时,在应用程序清单文件中设置一个意图过滤器,提及您的自定义操作。你已经完成了。只有分配有您的自定义操作意图过滤器的活动才会收到您的意图。

问题:我怎样才能得到
意图中唯一的 BUCKET_ID,因此
我不必与
潜在的非唯一性
BUCKET_DISPLAY_NAME?

不要尝试这样做,因为您可能会遇到麻烦,因为它可能会破坏您在以前的 Android 版本上的应用程序。

Question: is it still possible to
intercept this intent and allow the
user to choose my application to do
the Diashow?

Answer for your first question.... But with this, you might need to rebuild your app and then update...

To make it only your activity to receive the intent fired by you, add an additional flag to the intent or Create your own custom action and then fire an intent.
On receiving activity, set an intent filter in your application manifest file mentioning about your custom action. You're done here. Only the activity assigned with your custom action Intent filter will receive your Intent.

Question: how can I still get the
unique BUCKET_ID from the intent, so
that I do not have to work with a
potentially non-unique
BUCKET_DISPLAY_NAME?

Do not attempt this as you might end up in trouble as it might break your app on previous android versions.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文