How to open Firefox about:reader?url=example.com with Intent on Android

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP


How to open Firefox about:reader?url=example.com with Intent on Android



I'm a trying to open a webpage on an android application, the url sheme is a bit special it has to open an url in reader mode : about:reader?url=example.com


about:reader?url=example.com



I am doing it this way


Uri intentUri = new Uri.Builder().encodedPath("about:reader")
.appendQueryParameter("url", Uri.encode("example.com"))
.build();

// Try to open in Firefox If available or use default
Intent intent=new Intent(Intent.ACTION_VIEW);
intent.setData(intentUri);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setPackage("org.mozilla.firefox");

try {
getApplicationContext().startActivity(intent);
} catch (ActivityNotFoundException ex) {
intent.setPackage(null);
getApplicationContext().startActivity(intent);
}



And i get E/AndroidRuntime: FATAL EXCEPTION: main



Caused by: android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=about:reader?url=http://example.com


Caused by: android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=about:reader?url=http://example.com



Is there a way to achieve this ?









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Makefile test if variable is not empty

Will Oldham

'Series' object is not callable Error / Statsmodels illegal variable name