android - 如何通过 Android 应用在 Facebook 上分享我的位置?
问题描述
我想通过我的 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:"));
推荐阅读
- arduino - Arduino 到 PC 通信
- ms-access - 从表单更新非当前记录
- css - 根据列宽添加新的拟合行?
- javascript - 如何对依赖于复杂 Vuex 存储并扩展另一个组件的 Vue.js 组件进行单元测试?
- java - Android Studio“变量'示例'可能尚未初始化”现在该怎么办?
- matlab - 带嵌套积分的数值积分
- python - 在特定字符串之后匹配重复模式
- nativescript - 是否可以将文本、图像和文件共享到使用 Nativescript 编写的 Android 或 iOS 应用程序中?
- javascript - 如何将 MediaFile 对象转换为文件对象?
- php - laravel 护照和端点权限