【发布时间】:2020-04-26 09:21:14
【问题描述】:
编辑
仅供参考,从 lookupKey(类似于“1450iSkype_288”)中提取 RawContactID 的技巧不再起作用。
总结
我能够获取“Skype ID”/“Skype 用户名”,但我的解决方案并不总是有效,因为 Skype 应用程序的联系人数据库似乎并不总是包含(公开?)“所有”数据。
在问我的问题之前让我解释一下情况:
1 - 从 Skype apk 收集信息
Skype App (apk) 包含 /res/xml/contacts.xml 其中包含
<ContactsDataKind
android:icon="@ref/0x7f0e0004"
android:mimeType="vnd.android.cursor.item/com.skype4life.audio"
android:summaryColumn="data3"
android:detailColumn="data4" />
<ContactsDataKind
android:icon="@ref/0x7f0e0004"
android:mimeType="vnd.android.cursor.item/com.skype4life.video"
android:summaryColumn="data3"
android:detailColumn="data4" />
<ContactsDataKind
android:icon="@ref/0x7f0e0004"
android:mimeType="vnd.android.cursor.item/com.skype4life.message"
android:summaryColumn="data3"
android:detailColumn="data4" />
<ContactsDataKind
android:icon="@ref/0x7f0e0004"
android:mimeType="vnd.android.cursor.item/com.skype4life.phone"
android:summaryColumn="data3"
android:detailColumn="data4" />
这里的重要数据是这 4 种 Skype mimeTypes:
"vnd.android.cursor.item/com.skype4life.phone"
"vnd.android.cursor.item/com.skype4life.message"
"vnd.android.cursor.item/com.skype4life.audio"
"vnd.android.cursor.item/com.skype4life.video"
注意:
看起来这些是在 2018 年 Augustus 前后添加的(请参阅此处http://www.skaip.org/skype-8-27-0-88-for-android)
另一个有用的信息是 Skype 的ContactsContract.RawContacts.ACCOUNT_TYPE 是"com.skype.raider"
2 - 查询内容提供者
使用在第 1 点中获得的信息,我可以query Skype ContentProvider(使用选择 ContactsContract.Data.MIMETYPE+ "= ? " 和 selectionArgs "com.skype.raider" )并获得必须根据“解释”的数据到 mimeType(在第 1 点中获得的 4 个 Skype mimeTypes 之一)。
2.1 - 对于 mimeType vnd.android.cursor.item/com.skype4life.message,我得到如下内容:
mimetype = vnd.android.cursor.item/com.skype4life.message
_id = 2773
lookup = 1450iSkype_288
contact_id = 1601
display_name = <Skype User DISPLAY Name HERE>
raw_contact_id = 515
mimetype = vnd.android.cursor.item/com.skype4life.message
data1 = 8:<skype.user.name.value.here>
data2 = null
data3 = Skype
is_primary = 0
data5 = null
在哪里
<Skype User DISPLAY Name HERE> is an actual Display Name
<skype.user.name.value.here> is an actual Skype user name / Skype ID
<skype.user.name.value.here>是我要的数据,这样就好了!
重要提示:
编辑:这个技巧不再起作用 ->
lookup = 1450iSkype_288 可以解析得到288,它是某个其他联系人的 RawcontactId!
如果这个 rawContact 有一个contactId,那么这允许我找到原始联系人(与 RawContact 相比)
它甚至有时会引用一些不是 Google 联系人的联系人,但是,例如,WhatsApp 联系人!
享受这些重要信息 ;-)
2.2 - 这两个 mimeTypes 的相似数据:
"vnd.android.cursor.item/com.skype4life.audio"
"vnd.android.cursor.item/com.skype4life.video"
所以我也可以获得<skype.user.name.value.here>。再次,这很好!
2.3 - Phone mimeType
"vnd.android.cursor.item/com.skype4life.phone"
不包含 Skype ID(在 data1 字段中),而是包含电话号码,这是有道理的。
3 - 问题
所以,这一切都很好,我决定在其他一些设备上测试我的代码,我安装了 Skype 并使用相同的 Skype 帐户 + 相同的 Google 帐户,BOOM,这里是问题:
Skype 内容提供程序只有 mimeType 的数据
"vnd.android.cursor.item/com.skype4life.phone" // <- contains Skype user's phone number, NOT Skype user name / Skype ID
并且没有这 3 种 mimeType 的数据
"vnd.android.cursor.item/com.skype4life.message" // <- contains Skype username / ID
"vnd.android.cursor.item/com.skype4life.audio" // <- contains Skype username / ID
"vnd.android.cursor.item/com.skype4life.video" // <- contains Skype username / ID
Skype 电话号码仅用于通过 Skype 拨打电话,但这不是我想做的:我想通过“互联网 Skype 音频/视频”通话,而不是“普通手机”通话。
4 - 问题
为什么 Skype 应用有时会存储所有 4 个“电话/消息/音频/视频”mimeType 数据,有时只存储“电话”mimeType?
在后一种情况下,我无法获取 Skype Ids / Skype 用户名,即我上面提到的 <skype.user.name.value.here>。
我知道我的解决方案是某种“类似逆向工程的方法”的结果,根本不是“官方”的,但也许其他人做了我做过的同样的调查并且可以找到解决方案?
也许应该在 Skype 应用程序或 Android 中激活一些“Skype 同步设置”?
我已经强制为 Google 和 Skype 帐户重新同步联系人,但这没有帮助。
感谢您的帮助。
【问题讨论】:
-
仅供参考,我也在 answers.microsoft.com 上发布了这个:answers.microsoft.com/en-us/skype/forum/sk_dev-sk_devbots/…
标签: android android-contentprovider skype