Issue
I am having a HTML page which works only on mozilla firfox because of some security issues it does not work over Chrome browser, So How could i embed a mozilla firefox in webview or something I can do to open the page by default in firefox browser in an android application, Below is my code `public class InteractivityPage extends AppCompatActivity {
private WebView webView;
Activity activity;
String url = "https://s3.ap-south-1.amazonaws.com/indiannica/interactivity/Interactivity_sample/correct_order/index.html";
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.interactivitypage);
activity = this;
webView = (WebView) findViewById(R.id.webview);
webView.setWebViewClient(new MyBrowser());
webView.getSettings().setLoadsImagesAutomatically(true);
webView.getSettings().setJavaScriptEnabled(true);
webView.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
webView.loadUrl(url);
}
private class MyBrowser extends WebViewClient {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return true;
}
}
}
`
The code opening the webview but the page does not work due to Chrome browser therefore Need here Firefox, Please help how to embed Firefox in webview.
Solution
Finally come up with the solution, which open the page in a new Firefox tab, I am working to open this tab in-app browser of the android application.
String url = "https://s3.ap-south-1.amazonaws.com/indiannica/interactivity/Interactivity_sample/correct_order/index.html";
Intent intent= new Intent(Intent.ACTION_VIEW, Uri.parse(url));
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setPackage("org.mozilla.firefox");
try{
context.startActivity(intent);
}
catch(ActivityNotFoundException ex)
{ intent.setPackage(null);
context.startActivity(intent);
}`
Answered By - supriya chauhan
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.