Android - Java - Intent to send facebook chat message (facebook disabled xmpp)

前端 未结 2 459
天命终不由人
天命终不由人 2021-01-27 06:31

***Facebook deprecated xmpp api.

Is there a way to open an intent (or pass data to fb) to send chat message on android device? Facebook & Messenger apps installed on

2条回答
  •  一生所求
    2021-01-27 07:22

    To launch facebook app let urlString = "fb://page/your_fb_page_id"

    To launch facebook messenger let urlString = "fb-messenger://user/your_fb_page_id"

    FB page id is usually numeric. To get it, goto Find My FB ID input your profile url, something like www.facebook.com/edgedevstudio then click "Find Numberic ID".

    Voila, you now have your fb numeric id. replace "your_fb_page_id" with the generated Numeric ID

     val intent = Intent(Intent.ACTION_VIEW, Uri.parse(urlString))
     if (intent.resolveActivity(packageManager) != null) //check if app is available to handle the implicit intent
     startActivity(intent)
    

提交回复
热议问题