katzer / cordova-plugin-printer

Print HTML documents
Apache License 2.0
311 stars 290 forks source link

Plugin crash App build with Intel XDK #25

Closed alexander-schranz closed 9 years ago

alexander-schranz commented 9 years ago

On my Nexus 4 with Android 4.4.4 my generated app crash until the print function was called. ServiceIsAvailable does not crash. App was created with Intel XDK.

Some Information
Q A
OS Android
OS Version 4.4.4
Device Nexus 4
Builder Intel XDK
Cordova Version 3.3
Enabled Cordova Plugins Device, Splashscreen
Enabled Intel XDK Plugins Base
Third Party Plugins Cordova Print Plugin
Third Party Plugins Include way by PluginId (de.appplant.cordova.plugin.printer) over Apache Cordova Plugins Registry
Extra Added Permissons none
Test Environments Tested with Crosswalk and without
Enabled Print Services Google Cloud Print, HP Print Plugin, Epson Print
Code
cordova.plugins.printer.isAvailable(
    function (isAvailable) {
        if (isAvailable) {
            $('.print-btn').show();
            $('.print-btn').click(function() {
                var page = document.body;
                // crash when call print
                cordova.plugins.printer.print(page, 'index.html', function () {
                });  
            });
         }
    }
);

any ideas how I can fix it to get it work with Intel XDK?

aniljailta commented 9 years ago

Even i am getting same issue there. My app gets stopped when i call cordova print. Did you get any solution for it?

alexander-schranz commented 9 years ago

No, I still wait for some support here :).

katzer commented 9 years ago

which branch/version?

aniljailta commented 9 years ago

Branch is master Branch for Android >= 4.4 (>= v0.7.x). Testing it on android 4.4.4. cordova version 3.5.0

code is

   cordova.plugins.printer.isAvailable(
    function (isAvailable) {     
      if(isAvailable){
       var page = location.href;
       cordova.plugins.printer.print(page, 'Document.html', function () {
         alert('printing finished or canceled')
       });
      }
    }
  );
katzer commented 9 years ago

can't reproduce - but I am not using Intel XDK! Do you have any logs about the error?

aniljailta commented 9 years ago

well i don't have any logs . I am unable to track them . I tried to do remote debugging but console also get closed when app crash.

  cordova.plugins.printer.isAvailable(
   function (isAvailable,installedAppIds) {
 //show me alert
    alert(isAvailable ? 'Service is available' : 'Service NOT available');
    console.log(installedAppIds);  
 //installedAppIds is undefined. Does it work in new master branch.?

 //get crashed here.  
    plugin.printer.print('content', { appId: 'com.zebra.android.zebrautilities' });   
//Here i am trying to print using zebra utilities. 
  }
 );

cordova.plugins.printer.print(page, 'Document.html', function () { alert('printing finished or canceled') });

Tried this but same thing. crashed again.

I am testing things in kitkat version 4.4.4. Kindly help me here. I am not able to get any solution regarding this.

alexander-schranz commented 9 years ago

@katzer sorry for my late response only got today some time to test. @aniljailta there are some crash log reader in android store.

Back to topic. For me it did fix the crash when I directly use this GIT REPO instead of select the checkbox that the Plugin is in Apache Cordova Plugins Registry (maybe the version there of the plugin is deprecated). For me it did also work with Cordova 3.5 in Intel XDK.

@katzer is there any plans to support >=4.4 and <=4.3 in one branch?

katzer commented 9 years ago

is there any plans to support >=4.4 and <=4.3 in one branch?

Yes -if possible- with 0.8

marcelodelta commented 9 years ago

I am also having the same problem.