Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/qt/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 使用意图操作发送到共享数据,从锚链接到特定应用程序_Android_Android Intent_Telegram - Fatal编程技术网

Android 使用意图操作发送到共享数据,从锚链接到特定应用程序

Android 使用意图操作发送到共享数据,从锚链接到特定应用程序,android,android-intent,telegram,Android,Android Intent,Telegram,我想用一个链接将我的网站上的数据共享到Android应用程序上。 例如,当用户单击以下链接时: 浏览器启动电报应用程序,并要求用户选择一个联系人向他/她发送额外的_文本。但上述代码仅打开电报应用程序,不会将额外的_文本传递给应用程序 我找到了这本指南,但这是JAVA,我不知道如何在链接中使用这段代码: Intent sendIntent = new Intent(); sendIntent.setAction(Intent.ACTION_SEND); sendIntent.putExtra(In

我想用一个链接将我的网站上的数据共享到Android应用程序上。 例如,当用户单击以下链接时: 浏览器启动电报应用程序,并要求用户选择一个联系人向他/她发送额外的_文本。但上述代码仅打开电报应用程序,不会将额外的_文本传递给应用程序

我找到了这本指南,但这是JAVA,我不知道如何在链接中使用这段代码:

Intent sendIntent = new Intent();
sendIntent.setAction(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_TEXT, "This is my text to send.");
sendIntent.setType("text/plain");
startActivity(sendIntent);

将数据方案和参数放在锚定标签中。例如:

myappschema://?令牌=123

它将在其中向myappschema发送令牌

在应用程序的AndroidManifest中;将此意向筛选器放在您希望从web打开的活动上

<intent-filter>
                <action android:name="android.intent.action.VIEW" />

                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <category android:name="android.intent.category.LAUNCHER" />
                <category android:name="android.intent.category.APP_BROWSER" />
                <data android:scheme="myappschema" />
</intent-filter>
在你的活动中;您可以从Intent获取数据。
例如:uridata=getIntent.getData

错误是什么?它只是打开了电报应用程序,没有将多余的文本传递给应用程序。谢谢,伙计!但我不想创建一个应用程序。我只想做一个很酷的分享按钮,把网页上的内容分享到任何android应用程序上,比如Telegrame,那么分享的意图就在那里了!只需将其与您希望共享的内容一起使用即可