how to convert beloved android code into nativescript

Issue

i try to convert beloved code same into nativescript but i am new i have no idea for this please tell me how to convert android code to nativescript …

 private void createWebPrintJob() {

    // Get a PrintManager instance
    PrintManager printManager = (PrintManager)
            getSystemService(Context.PRINT_SERVICE);

    // Get a print adapter instance
    PrintDocumentAdapter printAdapter = webView.createPrintDocumentAdapter();

    // Create a print job with name and adapter instance
    String jobName = getString(R.string.app_name) + " Document";
    PrintJob printJob = printManager.print(jobName, printAdapter,
            new PrintAttributes.Builder().build());

    // Save the job object for later status checking
    // mPrintJobs.add(printJob);
}

Solution

May be something like this,

var application = require('application');
var utils = require('utils/utils');

function createWebPrintJob() {
 var printManager = application.android.context
           .getSystemService(android.content.Context.PRINT_SERVICE);
 var printAdapter = webView.createPrintDocumentAdapter();
 var jobName = getString(utils.ad.getStringId("app_name")) + " Document";
 var printJob = printManager.print(jobName, printAdapter, new namespace.to.PrintAttributes.Builder().build());
 mPrintJobs.add(printJob);
}

The above is just puedo code, end of the day it’s JavaScript nothing super special.

Answered By – Manoj

Answer Checked By – Gilberto Lyons (AngularFixing Admin)

Leave a Reply

Your email address will not be published.