cmd scheme 启动application

本文介绍了如何通过指定URI启动Facebook应用程序中的特定功能页面,包括消息收件箱、个人资料墙等,并提供了使用不同协议(如facebook://和fb://)的详细示例。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

10 down vote accepted

To just start the default Launcher Activity:

Intent intent = new Intent("android.intent.category.LAUNCHER");
intent.setClassName("com.facebook.katana", "com.facebook.katana.LoginActivity");
startActivity(intent);

I did some research, because I wanted to find this out :). I found some ways how to start different activities easily. But I can not guarantee that this will work after upgrades of facebook. I tested it with my current facebook app and it works. At least I tested it with "adb shell" using "am start .....".

Basic is:

String uri = "facebook://facebook.com/inbox";
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));
startActivity(intent);

the facebook.com part is not checked. you can even type: "facebook://gugus.com/inbox" having the same effect.

How to do this in adb.

1. Start adb shell through console: "adb shell"
2. run: "am start -a android.intent.action.VIEW -d facebook://facebook.com/inbox"

this will start the inbox activity.Here some Uris with examples. I think they speak for themselves what they do.

facebook://facebook.com/inbox
facebook://facebook.com/info?user=544410940     (id of the user. "patrick.boos" won't work)
facebook://facebook.com/wall
facebook://facebook.com/wall?user=544410940   (will only show the info if you have added it as friend. otherwise redirects to another activity)
facebook://facebook.com/notifications
facebook://facebook.com/photos
facebook://facebook.com/album
facebook://facebook.com/photo
facebook://facebook.com/newsfeed

there might be additianl parameters you can give to certain of those uris, but I have no time to go through all the code of those activities.

How did I do this? check out apktool.

link | improve this answer
 
It seems like this doesnt work anymore ( and it definitely used to!). facebook://facebook.com/wall?user=1230123 just opens Facebook to the Stream activity, and not the wall of the specified user. –  NPike Jul 9 '11 at 23:33
 
Figured it out, see my post below about the new protocols. –  NPike Jul 10 '11 at 0:17
 
Hello Patrick: Here it opens up the installed facebook app,But i need to open the facebook app with the update status opened along with the image attached to the status , how to achieve this ...?any help is greatly appreciated ... –  Rajesh Rs Jan 19 at 12:20
 
sorry.. i guess those were from a older version. check out @NPike's post. Those might be the ones you need :) –  Patrick Boos Jan 20 at 1:19
1 
What happens if the application isn't installed ? –  Gp2mv3 Jan 26 at 19:43
show 3 more comments
feedback

Looking at the latest Facebook apk (1.6), it looks like both "facebook://" and "fb://" are registered protocols.

facebook://

facebook:/chat
facebook:/events
facebook:/friends
facebook:/inbox
facebook:/info
facebook:/newsfeed
facebook:/places
facebook:/requests
facebook:/wall

fb://

fb://root
fb://feed
fb://feed/{userID}
fb://profile
fb://profile/{userID}
fb://page/{id}
fb://group/{id}
fb://place/fw?pid={id}
fb://profile/{#user_id}/wall
fb://profile/{#user_id}/info
fb://profile/{#user_id}/photos
fb://profile/{#user_id}/mutualfriends
fb://profile/{#user_id}/friends
fb://profile/{#user_id}/fans
fb://search
fb://friends
fb://pages
fb://messaging
fb://messaging/{#user_id}
fb://online
fb://requests
fb://events
fb://places
fb://birthdays
fb://notes
fb://places
fb://groups
fb://notifications
fb://albums
fb://album/{%s}?owner={#%s}
fb://video/?href={href}
fb://post/{postid}?owner={uid}¹

Sorry if I missed some... only played with a handful of them in the emulator to see if they actually work - a bunch of them will cause the Facebook application to crash.

¹ where postid is in the uid_postid format, e.g 11204705797_10100412949637


打印台输出: 🔍 正在获取应用 com.baidu.searchbox 的所有权限... 🔧 [DEBUG] 执行命令: adb shell pm dump com.baidu.searchbox 🔧 [DEBUG] ADB 原始输出长度: 456188 字符 🔧 [DEBUG] 输出截取(前500字符): DUMP OF SERVICE package: Activity Resolver Table: Full MIME Types: application/x-zip-compressed: 7f4861d com.baidu.searchbox/.download.center.ui.DownloadedCategorySecActivity filter b682092 Action: "android.intent.action.VIEW" Category: "android.intent.category.DEFAULT" Category: "android.intent.category.BROWSABLE" Scheme: "content" Scheme: "file" Path: "PatternMatcher{GLOB: .*\.zip}" Path: "PatternMatcher{GLOB: .*\.\w+\.zip}" Path: "PatternMatcher{GLOB: .*\.7z}" Path: "PatternMatcher{GLOB: .*\.\w+\.7z}" Path: "PatternMatcher{GLOB: .*\.rar}" Path: "PatternMatcher{GLOB: .*\.\w+\.rar}" StaticType: "application/zip" StaticType: "application/x-zip-compressed" StaticType: "application/x-7z-compressed" StaticType: "application/rar" StaticType: "application/x-rar-compressed" application/pdf: c611dca com.baidu.searchbox/.plugins.PDFViewerActivity filter a96b3b Action: "android.intent.action.VIEW" Category: "android.intent.category.DEFAULT" StaticType: "application/pdf" application/rar: 7f4861d com.baidu.searchbox/.download.center.ui.DownloadedCategorySecActivity filter b682092 Action: "android.intent.action.VIEW" Category: "android.intent.category.DEFAULT" Category: "android.intent.category.BROWSABLE" Scheme: "content" Scheme: "file" Path: "PatternMatcher{GLOB: .*\.zip}" Path: "PatternMatcher{GLOB: .*\.\w+\.zip}" Path: "PatternMatcher{GLOB: .*\.7z}" Path: "PatternMatcher{GLOB: .*\.\w+\.7z}" Path: "PatternMatcher{GLOB: .*\.rar}" Path: "PatternMatcher{GLOB: .*\.\w+\.rar}" StaticType: "application/zip" StaticType: "application/x-zip-compressed" StaticType: "application/x-7z-compressed" StaticType: "application/rar" StaticType: "application/x-rar-compressed" application/zip: 7f4861d com.baidu.searchbox/.download.center.ui.DownloadedCategorySecActivity filter b682092 Action: "android.intent.action.VIEW" Category: "android.intent.category.DEFAULT" Category: "android.intent.category.BROWSABLE" Scheme: "content" Scheme: "file" Path: "PatternMatcher{GLOB: .*\.zip}" Path: "PatternMatcher{GLOB: .*\.\w+\.zip}" Path: "PatternMatcher{GLOB: .*\.7z}" Path: "PatternMatcher{GLOB: .*\.\w+\.7z}" Path: "PatternMatcher{GLOB: .*\.rar}" Path: "PatternMatcher{GLOB: .*\.\w+\.rar}" StaticType: "application/zip" StaticType: "application/x-zip-compressed" StaticType: "application/x-7z-compressed" StaticType: "application/rar" StaticType: "application/x-rar-compressed" application/vnd.openxmlformats-officedocument.presentationml.presentation: 170d258 com.baidu.searchbox/.plugins.PPTViewerActivity filter 55b4c96 Action: "android.intent.action.VIEW" Category: "android.intent.category.DEFAULT" Scheme: "file" Scheme: "content" Path: "PatternMatcher{GLOB: .*\.pptx}" StaticType: "application/vnd.openxmlformats-officedocument.presentationml.presentation" application/vnd.ms-powerpoint: 170d258 com.baidu.searchbox/.plugins.PPTViewerActivity filter 5308fb1 Action: "android.intent.action.VIEW" Category: "android.intent.category.DEFAULT" Scheme: "file" Scheme: "content" Path: "PatternMatcher{GLOB: .*\.ppt}" StaticType: "application/vnd.ms-powerpoint" application/vnd.openxmlformats-officedocument.wordprocessingml.document: b398017 com.baidu.searchbox/.plugins.DOCViewerActivity filter 20d75ed Action: "android.intent.action.VIEW" Category: "android.intent.category.DEFAULT" Scheme: "file" Scheme: "content" Path: "PatternMatcher{GLOB: .*\.docx}" StaticType: "application/vnd.openxmlformats-officedocument.wordprocessingml.document" audio/*: b35adee com.baidu.searchbox/.systemshare.SystemShareToNetDisk filter 4edc28f Action: "android.intent.action.SEND" Category: "android.intent.category.DEFAULT" StaticType: "image" StaticType: "video" StaticType: "audio" mPriority=0, mOrder=0, mHasStaticPartialTypes=true, mHasDynamicPartialTypes=false application/vnd.ms-excel: bf79c22 com.baidu.searchbox/.plugins.EXCELViewerActivity filter e4c06b3 Action: "android.intent.action.VIEW" Category: "android.intent.category.DEFAULT" Scheme: "file" Scheme: "content" Path: "PatternMatcher{GLOB: .*\.xls}" StaticType: "application/vnd.ms-excel" application/x-rar-c... 🔧 [DEBUG] 找到 0 个权限声明段落 🔧 [DEBUG] 总共找到 0 个有效权限 ⚠️ dumpsys 未找到权限,尝试解析 APK 中的 AndroidManifest.xml... ❌ 未找到任何权限声明,请检查 ADB 输出或手动提供权限列表
最新发布
08-12
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值