【问题标题】:How to programmatically share GPS location from Android application in Telegram?如何以编程方式从 Telegram 中的 Android 应用程序共享 GPS 位置?
【发布时间】:2020-03-27 18:14:53
【问题描述】:

如何在 Telegram 中以编程方式从 Android 应用程序共享 GPS 位置?

地理坐标不必是当前的地理位置。我对将坐标(纬度和经度)从我的应用程序传输到信使的能力感兴趣,如图所示

【问题讨论】:

    标签: java android telegram


    【解决方案1】:

    这是与其他应用分享文本的方法:

    Intent sendIntent = new Intent(Intent.ACTION_SEND);
    sendIntent.putExtra(Intent.EXTRA_TEXT, "Hello!");
    
    // (Optional) Here we're setting the title of the content
    sendIntent.putExtra(Intent.EXTRA_TITLE, "Send message");
    
    // (Optional) Here we're passing a content URI to an image to be displayed
    sendIntent.setData(contentUri);
    sendIntent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
    
    // Show the Sharesheet
    startActivity(Intent.createChooser(sendIntent, null));
    

    您可以使用这样的坐标来代替“hellow”:

    https://www.google.com/maps/@[lat],[long],[zoom]z

    例子

    https://www.google.com/maps/@14.878651,50.2937643,4z

    如果你只想发送到电报,你可以use this

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-10-06
      • 1970-01-01
      • 2016-08-31
      • 2018-07-29
      • 2015-06-24
      • 1970-01-01
      相关资源
      最近更新 更多