Reputation: 454
I want to use intent share button on browser by overlapping screen, not moving to another app.
This is my AndroidManifest.xml
and SendActivity.java
<activity
android:name=".SendActivity"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme">
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<!-- <category android:name="android.intent.category.BROWSABLE" /> -->
<data android:mimeType="text/plain" />
</intent-filter>
</activity>
package com.example.my_app;
import android.content.Intent;
import android.os.Bundle;
import android.app.Activity;
import java.nio.ByteBuffer;
public class SendActivity extends Activity { }
This is my situation. When I click an app, the screen moves to another app.
I want to open sendActivity like pocket app in below.
Upvotes: 0
Views: 50
Reputation: 525
If you want to send data without opening another app, then you could write up a service which will run natively.
The flutter app will invoke a method channel, that will pass the data to be shared to that service, then it's up to the background service, which I believe since Android 8 has a lifespan limit of 10 minutes. This service will then handle the sharing and can send the data off to another server, or another broadcast receiver.
However if you need the user to be able to configure how they want to send their data (which app), who they will send it to, etc, then you will need to use a bound activity on the device.
You can use these packages to manage this:
This package allows you to share files into other applications: https://pub.dev/packages/flutter_share
And this package allows you to share simple text: https://pub.dev/packages/share
Upvotes: 1