Flutter 如何在接收另一个应用程序共享的文件时打开特定屏幕
我有一个要求,当用户点击我的颤振应用程序中的一个按钮时,我会将用户重定向到我无法访问的其他应用程序。然后,用户需要从该应用程序共享一个文件。使用意图过滤器,我接收ReceiveIntent.java类中的文件 AndroidManifest.xmlFlutter 如何在接收另一个应用程序共享的文件时打开特定屏幕,flutter,share,intentfilter,Flutter,Share,Intentfilter,我有一个要求,当用户点击我的颤振应用程序中的一个按钮时,我会将用户重定向到我无法访问的其他应用程序。然后,用户需要从该应用程序共享一个文件。使用意图过滤器,我接收ReceiveIntent.java类中的文件 AndroidManifest.xml <activity android:label="SampleApp" android:exported="true" android:name="com.sampleapp.example
<activity
android:label="SampleApp"
android:exported="true"
android:name="com.sampleapp.example.ReceiveIntent"
android:hardwareAccelerated="true"
android:launchMode="singleTask"
android:theme="@style/LaunchTheme"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<action android:name="android.intent.action.VIEW"/>
</intent-filter>
<intent-filter tools:ignore="AppLinkUrlError">
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="application/zip"/>
</intent-filter>
</activity>
在这里之前一切都很好。但我不想把用户从这里重定向到密码解锁屏幕。我点击了这里。
我尝试了方法频道,但播放该方法频道的颤振小部件没有被触发
感谢您的帮助
提前谢谢
private void handleIntent(Intent intent){
// Get intent, action and MIME type
String action = intent.getAction();
String type = intent.getType();
if (Intent.ACTION_SEND.equals(action) && type != null) {
if (type.equalsIgnoreCase("application/zip")) {
handleSharedZIP(intent); // Handle text being sent
} else if (type.startsWith("image/*")) {
handleSendImage(intent); // Handle single image being sent
}
}
}
private void handleSharedZIP(Intent intent) {
try {
// pass the the path received from the intent filters to password unlock screen. So
that we can verify and Extract the data there.
Uri uri = intent.getParcelableExtra(Intent.EXTRA_STREAM);
sharedZIP = uri.toString();
sharedZIPMethodChannel.invokeMethod("getSharedZIP",sharedZIP);
}catch (Exception e){
e.printStackTrace();
e.getMessage();
Log.d("error",e.getMessage().toString());
}
}