cmd scheme 啟動application

來源:互聯網
上載者:User
10
down voteaccepted

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/inboxfacebook://facebook.com/info?user=544410940     (id of the user. "patrick.boos" won't work)facebook://facebook.com/wallfacebook://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/notificationsfacebook://facebook.com/photosfacebook://facebook.com/albumfacebook://facebook.com/photofacebook://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 edited
Nov 16 '10 at 7:01
answered
Nov 16 '10 at 6:55

Patrick Boos
1,319513
 
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

up vote
7
down vote

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

facebook://

facebook:/chatfacebook:/eventsfacebook:/friendsfacebook:/inboxfacebook:/infofacebook:/newsfeedfacebook:/placesfacebook:/requestsfacebook:/wall

fb://

fb://rootfb://feedfb://feed/{userID}fb://profilefb://profile/{userID}fb://page/{id}fb://group/{id}fb://place/fw?pid={id}fb://profile/{#user_id}/wallfb://profile/{#user_id}/infofb://profile/{#user_id}/photosfb://profile/{#user_id}/mutualfriendsfb://profile/{#user_id}/friendsfb://profile/{#user_id}/fansfb://searchfb://friendsfb://pagesfb://messagingfb://messaging/{#user_id}fb://onlinefb://requestsfb://eventsfb://placesfb://birthdaysfb://notesfb://placesfb://groupsfb://notificationsfb://albumsfb://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

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.