【问题标题】:How to share my location on Facebook through Android App?如何通过 Android 应用在 Facebook 上分享我的位置?
【发布时间】:2020-05-29 21:13:41
【问题描述】:

我想通过我的 Kotlin 应用在 Facebook 上分享/发布我的位置。有可能的?我已经知道可以与以下人员共享内容(链接、图像和文本):

startActivity(Intent.createChooser(shareIntent, "分享链接使用"))

但实际上我想发布我的位置。谢谢。

【问题讨论】:

    标签: android facebook kotlin


    【解决方案1】:

    你可以试试这个: 这是java在粘贴代码时会自动转换为kotlin。

    String uri = "http://maps.google.com/maps?saddr=" +loc.getLatitude()+","+loc.getLongitude();
    Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND);
    sharingIntent.setType("text/plain");
    sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "my location");
    sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, uri);
    startActivity(Intent.createChooser(sharingIntent, "Share with:"));
    

    【讨论】:

    • 哦,谢谢!有一种方法可以将文本添加为​​默认值?
    • “我的位置”文本。从选择器中选择时不会出现在 Facebook 应用中,因为添加了位置链接
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-01-03
    相关资源
    最近更新 更多