【发布时间】:2020-05-29 21:13:41
【问题描述】:
我想通过我的 Kotlin 应用在 Facebook 上分享/发布我的位置。有可能的?我已经知道可以与以下人员共享内容(链接、图像和文本):
startActivity(Intent.createChooser(shareIntent, "分享链接使用"))
但实际上我想发布我的位置。谢谢。
【问题讨论】:
我想通过我的 Kotlin 应用在 Facebook 上分享/发布我的位置。有可能的?我已经知道可以与以下人员共享内容(链接、图像和文本):
startActivity(Intent.createChooser(shareIntent, "分享链接使用"))
但实际上我想发布我的位置。谢谢。
【问题讨论】:
你可以试试这个: 这是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:"));
【讨论】: