android - Receiving simple data from other apps launches another application
问题描述
I do sharing from other applications according to the instructions https://developer.android.com/training/sharing/receive
<activity
android:name=".ui.activity.SplashActivity"
android:configChanges="orientation"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND" />
<data android:mimeType="image/*" />
</intent-filter>
</activity>
The icon in the list of sharing in the gallery appeared, everything works as it should, only there is one problem. If the application is already running and sharing it into it, then the application starts in parallel on a new one. The application is run twice at the time of the mecn.
And in another activism inserted - the same thing
<activity
android:name=".ui.activity.SharingActivity"
android:windowSoftInputMode="adjustPan"
android:configChanges="orientation"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*" />
</intent-filter>
</activity>
Does not matter, if the application is already running and sharing it into it, then the application starts in parallel on a new one. The application is run twice at the time of the mecn.
解决方案
我修复了这个时刻/需要添加到清单中的活动
android:launchMode="singleTask"
推荐阅读
- wpf - WPF:如何从我的解决方案中的文件夹加载页面
- eclipse - 如何在 Eclipse 2018-12 和 Fedora 29 上使用 JDK1.6 配置 JBoss 5.1.0GA?
- sql-server - 使用户 SQL Server 权限保持同步
- c# - 无法在 Xamarin.forms 中的 XAML 页面上看到绑定
- regex - python中的正则表达式提取某些代码
- android - 发出网络请求时无法命中断点
- c# - 使用 .NET 将图像上传到 BIM 360 项目
- r - 平均来自多个数据帧的行和列单元格
- javascript - 如何将 promise 用于异步功能?
- excel - 如何在执行 Excel 自动打开宏之前对其进行调试?