Open (redirect to) default browser


#1

How can implement this android/java code in nativescript/angular?

         Uri uri = Uri.parse("http://www.google.com");
         Intent intent = new Intent(Intent.ACTION_VIEW, uri);
         startActivity(intent);

#2

Hey @mortezadalil

Refer to the https://docs.nativescript.org/core-concepts/utils#openurl-method Docs page. So this can be broken down in these two steps:

  1. Import the utils/utils module:
    var utilsModule = require("tns-core-modules/utils/utils"); (import * as utilsModule from 'tns-core-modules/utils/utils in your case with the angular app)
  2. call the openUrl method:
    utilsModule.openUrl("https://google.com")