Zeeshan Mustafa
Zeeshan Mustafa

Reputation: 25

I want to open my FTP server page using Android Browser Intent

I use the following Code but the app just crashes as URI.Parse don't know how to handle ftp:/

Intent intent=new Intent(Intent.ACTION_VIEW, Uri.parse(LinkUrl.get("ftp:/192.168.0.103")));

startActivity(intent);

LOG Cat as Follows (The part that raised Exception):

2019-12-22 03:04:25.877 8018-8018/com.example.webview E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.example.webview, PID: 8018
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.webview/com.example.webview.MainActivity}: android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=ftp:///... }

Upvotes: 0

Views: 249

Answers (1)

CommonsWare
CommonsWare

Reputation: 1007349

Very few devices will have an app that supports the ftp scheme, as FTP is unpopular and insecure. You will need to catch the ActivityNotFoundException and gracefully handle the case where the user lacks an app that supports the ftp scheme.

Upvotes: 1

Related Questions