- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在开发的应用程序需要在可用的设备上利用其他应用程序的功能。
这是 Intents and Intent Filters 的范例应该在 Android 中处理。我将给出一个具体示例,说明对于所有情况,它在哪里失败(并且实际上没用)。
Example: Using an Intent to pass the content of an MMS to the messaging app:
- I go to the Intent class reference and find which system
ACTION
looks most appropriate (already am guessing -ACTION_SEND
vsACTION_SENDTO
vsACTION_VIEW
and assuming that theACTION
is one declared by the system)- I try and figure out if there is a specific
Uri
to supply for the data (there's this list for Google applications and I'm assuming this is then expected to be supplied by all apps and found individually?)- I now want to find what
EXTRA
keys should be used to supply the data (message body text, image). I have no idea and no hints whatsoever?
当然,我可以查看 StackOverflow 并找到答案 here和 here哪种给出了我正在寻找的答案(我还没有找到同时提供带有收件人 和 图像的彩信的任何答案)。但这实际上应该如何一般地完成呢?非系统、非通用、sms_body
EXTRA
key 是如何被人们发现的?
我唯一的答案是直接从应用程序本身收集解决方案(我认为反编译别人的工作已经不应该是正确的方向,但它是我唯一的方向)。所以我(这是通过支持短信的新环聊应用完成的):
- Download the app from my rooted device using
adb
in/data/app/
- Decompile using apktool and get the manifest file. From this I can see what
IntentFilter
s are defined. I cannot see anything to do withEXTRA
s because they are not declarable in anIntentFilter
- I try and get the source code by obtaining the
classes.dex
and decompiling using dex2jar and then view with JD-GUI and attempt to interpret barely readable 'half-decompressed' code to find use of theEXTRAS
that are passed in with theIntent
.
那是我尝试这样做的尝试,似乎即使在第一步(反编译其他应用程序)这也不是您应该前往的方向找出与明确需要的其他应用程序通信的语言与之交谈(应用声明一个IntentFilter
以声明它想要接收通过该过滤器的任何数据)。
唯一明显的答案是,可以通过 Android SDK 中的类访问某些内容,应用声明和定义它们希望接收的信息。我在这方面找到的最接近的是 PackageManager.GET_INTENT_FILTERS
标志,has not even been implmented.
Intent
以传递给需要此数据的应用?EXTRA
以通过 Intent
传递?除了 apk 的源代码之外,它们是否在其他任何地方定义?我一定遗漏了什么,因为在严重依赖应用程序间通信的手机操作系统中,为什么获取基本通信协议(protocol)会如此困难。
最佳答案
为什么你这么确定你错过了什么?
我认为这类似于找出 API 公开的某些命令。如果您运气好(java 类、带 wsdl 的 SOAP API),它实际上会告诉您可以做什么。但如果不是(REST API),你就会“卡住”阅读文档。这是一种实际的可能性,因此“我该怎么做”不必有答案。
在这种情况下,正如您发现的那样,没有一些类似 java 的“契约(Contract)”来阅读和弄清楚您可以做什么。也没有像 wsdl 这样的可访问文件,您可以使用它来查看您可以做什么
因此,您将不得不阅读您要使用的应用程序的文档。如果没有,您可能只能得出这样的结论。
除了技术限制外,您通过反编译找到的解决方案还有问题:因为它可能会发生变化。如果仅记录了某些额外功能,则说明您依赖于“隐藏”功能。第二条路,但有相同的问题,然后是一些,试图找到使用 Intent 的其他代码(如 stackoverflow 问题)。
关于java - 如何找到什么 'extras' 添加到与应用程序一起使用的 Intent ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20635133/
例如,我有一个父类Author: class Author { String name static hasMany = [ fiction: Book,
代码如下: dojo.query(subNav.navClass).forEach(function(node, index, arr){ if(dojo.style(node, 'd
我有一个带有 Id 和姓名的学生表和一个带有 Id 和 friend Id 的 Friends 表。我想加入这两个表并找到学生的 friend 。 例如,Ashley 的 friend 是 Saman
我通过互联网浏览,但仍未找到问题的答案。应该很容易: class Parent { String name Child child } 当我有一个 child 对象时,如何获得它的 paren
我正在尝试创建一个以 Firebase 作为我的后端的社交应用。现在我正面临如何(在哪里?)找到 friend 功能的问题。 我有每个用户的邮件地址。 我可以访问用户的电话也预订。 在传统的后端中,我
我主要想澄清以下几点: 1。有人告诉我,在 iOS 5 及以下版本中,如果您使用 Game Center 设置多人游戏,则“查找 Facebook 好友”(如与好友争夺战)的功能不是内置的,因此您需要
关于redis docker镜像ENTRYPOINT脚本 docker-entrypoint.sh : #!/bin/sh set -e # first arg is `-f` or `--some-
我是一名优秀的程序员,十分优秀!