从代码中使用 facebook.katana 又名 facebook 应用程序

发布于 2024-12-27 20:36:12 字数 2072 浏览 1 评论 0原文

我正在尝试实现一个解决方案,其中应用程序会询问您的 Android 手机中是否安装了 facebook.katana aka facebook 应用程序,如果已安装,请检查用户是否已登录,如果已登录,则发送带有文本的图片(更好)如果是文件夹),如果用户未登录,请转到 facebook.katana.LoginActivity 并登录他,然后执行程序。

我可以使用 Web 视图进行此操作,但我对如何使用该应用程序(如果可能的话)感兴趣,到目前为止我得到的是此 URL 中未编译的 facebook.katana,我正在其中测试活动:

http://xt720.ru/miui-trans/apk-decompiled/Facebook/smali/com/facebook/katana/

我也知道可以将图像附加到该应用程序,因为可以使用以下方法启动 facebook 应用程序:

final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
emailIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
emailIntent.putExtra(Intent.EXTRA_STREAM,imageUri);
emailIntent.setType("image/png");
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Whatever");
startActivity(Intent.createChooser(emailIntent, "Send email using"));

此方法对于电子邮件来说非常有用,但正如它所说,它会创建一个选择器,但我不想让该选项打开。所以我尝试了类似的方法:

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

您也可以使用 ShareLinkActivity 向您的意图添加额外内容,如下所示:

intent.putExtra(Intent.EXTRA_TEXT, "http://www.google.com/");

问题是我不知道如何将图像附加到武士刀,也不知道如何将其添加到文件夹,或者如何通过应用程序添加它,当然,通过 Android 的 facebook API 会更容易,但是就像我说的那样,这已经完成了,我想用 facebook 应用程序来实现它,我已经尝试过,将捆绑包作为可打包的应用程序附加到应用程序,使用 API 中完成的通常方式,但运气不好,这是片段:

Bundle params = new Bundle();
params.putByteArray("picture", bitmapdata);
params.putString("title", url);
params.putString("message","Wathever message");

并尝试发送params,也尝试仅发送图像,但运气不佳,也许我没有使用正确的类(请参阅未编译的 facebook.katana URL)或者我以错误的方式附加信息,它应该以某种方式工作,因为它适用于 ACTION_SEND,因此,任何人都知道如何解决以下问题:

  1. 将图像附加到 facebook.katana
  2. 将图像附加到文件夹中的 facebook.katana
  3. 将图像作为外部附加到 facebook.katana app
  4. 向 facebook.katana 请求用户的日志状态(我认为这会自动)
  5. 将图片、标题、消息参数附加到 facebook.katana。
  6. 发布为打开 facebook.katana 的应用程序(即使用 WebView 发布将显示“从 X 应用程序发布”

i´m trying to achieve a solution where the app ask if facebook.katana aka facebook app is installed in your android phone, if it is installed, check if the user is logged, and if it's logged send a picture with a text (better if it is to a folder), if the user is not logged go to the facebook.katana.LoginActivity and log him, after that make the procedure.

I have this working with a Web View, but i'm interested on how to do it using the app if possible, what i got so far is the uncompiled facebook.katana in this URL where i'm testing the activities:

http://xt720.ru/miui-trans/apk-decompiled/Facebook/smali/com/facebook/katana/

I also know that an image can be attached to that app, since can start the facebook app using this:

final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
emailIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
emailIntent.putExtra(Intent.EXTRA_STREAM,imageUri);
emailIntent.setType("image/png");
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Whatever");
startActivity(Intent.createChooser(emailIntent, "Send email using"));

This method would be great for an email, but as it says it creates a chooser, but i don't want to let that option open. So i tried something like:

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

Also you can use the ShareLinkActivity to add an extra to your intent like this:

intent.putExtra(Intent.EXTRA_TEXT, "http://www.google.com/");

The problem is that i don't see how to attach the image to the katana, neither, how to add it to a folder, or how to add it through an application, of course this is much easier via facebook API for android, but like i said that's already done, i want to make it with the facebook App, i have tried, attaching the Bundle to the app as a parcelable, with the usual way it is done in the API, but not luck, this is the snippet:

Bundle params = new Bundle();
params.putByteArray("picture", bitmapdata);
params.putString("title", url);
params.putString("message","Wathever message");

and try to send the params, also tried sending only the image, but not luck, maybe i'm not using the right class (see the uncopiled facebook.katana URL) or i´m attaching in a bad way the info, it should work somehow, cause it works for ACTION_SEND, so, anybody knows how to solve any of this problems:

  1. Attach an image to the facebook.katana
  2. Attach an image to the facebook.katana in a folder
  3. Attach an image to the facebook.katana as an external app
  4. Request the log status of the user to the facebook.katana (i think this would be automatically)
  5. Attach the picture, title, message params to the facebook.katana.
  6. Publish as the app that opens the facebook.katana (i.e. publishin with the WebView will show "published from X app"

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文