Surile / react-native-sunmi-printer

商米内置打印机
MIT License
44 stars 28 forks source link

Not working on Sunmi V3 Mix android 13 #46

Open YasirNaeem25 opened 4 months ago

YasirNaeem25 commented 4 months ago

buildscript { if (project == rootProject) { repositories { google() jcenter() }

dependencies {
  classpath 'com.android.tools.build:gradle:3.5.3'
}

} }

apply plugin: 'com.android.library'

def safeExtGet(prop, fallback) { rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback }

android { compileSdkVersion safeExtGet('compileSdkVersion', 33) buildToolsVersion safeExtGet('buildToolsVersion', '29.0.2') defaultConfig { minSdkVersion safeExtGet('minSdkVersion', 21) targetSdkVersion safeExtGet('targetSdkVersion', 33) versionCode 1 versionName "1.0"

}

buildTypes { release { minifyEnabled false } } lintOptions { disable 'GradleCompatible' } compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } }

repositories { mavenLocal() maven { // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm url("$rootDir/../node_modules/react-native/android") } google() jcenter() }

dependencies { //noinspection GradleDynamicVersion implementation "com.facebook.react:react-native:+" // From node_modules -- implementation "com.sunmi:printerlibrary:1.0.13" ++ implementation 'com.sunmi:printerlibrary:1.0.18' }

i make changes in build.gradle file but not working on SUNMI V3 Mix

sahil-foodbot commented 4 months ago

@YasirNaeem25 for me printColumnsString function not printing anything other things are working fine did u solved yours and same code printing everything on v2s plus

YasirNaeemHw commented 4 months ago

@sahil-foodbot i print look like this await SunmiPrinter.printColumnsString( ['Order Number', orderNo], [60, 120], // columnWidths [AlignValue.LEFT, AlignValue.RIGHT] );

sahil-foodbot commented 3 months ago

@YasirNaeem25 @YasirNaeemHw same code but not printing anything for me

SunmiPrinter.printColumnsString(
                        [contents('prints.discount'), '-$' + orderData.discount],
                        [120, 60],
                        [AlignValue.LEFT, AlignValue.RIGHT]
                    );

this one prints

                SunmiPrinter.printerText(contents('prints.ticketCode'))

                can you share your whole code and have you faced similar issue with you
YasirNaeemHw commented 3 months ago

@sahil-foodbot i test yesterday SunmiPrinter.printColumnsString(). not printing on client side you have any real device to test?

sahil-foodbot commented 3 months ago

@YasirNaeemHw i have remotely access to the v3 mix device but i have v2s plus with me code is working on v2s but not on v3 mix

YasirNaeemHw commented 3 months ago

@sahil-foodbot i use a bluetooth printer library because v3mix use bluetooth printer. i waiting to test on v3mix with bluetooth library.

sahil-foodbot commented 3 months ago

@YasirNaeemHw ok bro if you got success let me know i will try also try to do same.

YasirNaeem25 commented 3 months ago

@sahil-foodbot i able to print on Sunmi devices with the connectivity of via a bluetooth and to to print.i use this libary https://www.npmjs.com/package/react-native-bluetooth-escpos-printer

longphilongdf commented 3 months ago

buildscript { if (project == rootProject) { repositories { google() jcenter() }

dependencies {
  classpath 'com.android.tools.build:gradle:3.5.3'
}

} }

apply plugin: 'com.android.library'

def safeExtGet(prop, fallback) { rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback }

android { compileSdkVersion safeExtGet('compileSdkVersion', 33) buildToolsVersion safeExtGet('buildToolsVersion', '29.0.2') defaultConfig { minSdkVersion safeExtGet('minSdkVersion', 21) targetSdkVersion safeExtGet('targetSdkVersion', 33) versionCode 1 versionName "1.0"

}

buildTypes { release { minifyEnabled false } } lintOptions { disable 'GradleCompatible' } compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } }

repositories { mavenLocal() maven { // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm url("$rootDir/../node_modules/react-native/android") } google() jcenter() }

dependencies { //noinspection GradleDynamicVersion implementation "com.facebook.react:react-native:+" // From node_modules -- implementation "com.sunmi:printerlibrary:1.0.13" ++ implementation 'com.sunmi:printerlibrary:1.0.18' }

i make changes in build.gradle file but not working on SUNMI V3 Mix

Problem on sunmi v3 mix Do you have any solution yet?

sahil-foodbot commented 3 months ago

@longphilongdf can you please explain what issue you are getting for me its working fine WhatsApp Image 2024-04-04 at 16 55 53_14888ce0

longphilongdf commented 3 months ago

can you please explain what issue you are getting for me its working fine

@sahil-foodbot https://www.sunmi.com/en-US/v3-mix/ Everything is working properly except for the printer. When I try to print a receipt, it crashes

sahil-foodbot commented 3 months ago

can you please explain what issue you are getting for me its working fine

@sahil-foodbot https://www.sunmi.com/en-US/v3-mix/ Everything is working properly except for the printer. When I try to print a receipt, it crashes

any error logged in console that time i am also using v3 mix

longphilongdf commented 3 months ago

any error logged in console that time i am also using v3 mix

@sahil-foodbot Do I have to update to version 1.8.3?

sahil-foodbot commented 3 months ago

any error logged in console that time i am also using v3 mix

@sahil-foodbot Do I have to update to version 1.8.3?

did you added this in androidmanifest.xml

    <queries>
        <package android:name="woyou.aidlservice.jiuiv5" />
    </queries>
longphilongdf commented 3 months ago

not yet, let me try... Thank you!

sahil-foodbot commented 3 months ago

printerlibrary

also this on android/build.gradle inside dependencies

implementation 'com.sunmi:printerlibrary:1.0.18'
longphilongdf commented 3 months ago

@YasirNaeem25 for me printColumnsString function not printing anything other things are working fine did u solved yours and same code printing everything on v2s plus

It working but SunmiPrinter.printColumnsString() is error on V3 Mix are u fix it bro

sahil-foodbot commented 3 months ago

printerlibrary

also this on android/build.gradle inside dependencies

implementation 'com.sunmi:printerlibrary:1.0.18'

It working but SunmiPrinter.printColumnsString() is error on V3 Mix

same happened with me i am using this

 await SunmiPrinter.getPrinterPaper().then((data: any) => {
let linesWidth = data == "80mm" ? 42 : 28;
SunmiPrinter.setFontSize(26);
SunmiPrinter.printColumnsText(
      [item.quantity + "x " + item.item_display_text, "$" + item.item_price],
      // [ linesWidth - 8, 8],
      [ linesWidth - 8, 8],
      [AlignValue.LEFT, AlignValue.RIGHT]
  );
});
longphilongdf commented 3 months ago

printerlibrary

also this on android/build.gradle inside dependencies

implementation 'com.sunmi:printerlibrary:1.0.18'

It working but SunmiPrinter.printColumnsString() is error on V3 Mix

same happened with me i am using this

 await SunmiPrinter.getPrinterPaper().then((data: any) => {
let linesWidth = data == "80mm" ? 42 : 28;
SunmiPrinter.setFontSize(26);
SunmiPrinter.printColumnsText(
      [item.quantity + "x " + item.item_display_text, "$" + item.item_price],
      // [ linesWidth - 8, 8],
      [ linesWidth - 8, 8],
      [AlignValue.LEFT, AlignValue.RIGHT]
  );
});

let me try! Thank u so much bro!

longphilongdf commented 3 months ago

hi @sahil-foodbot Do you know the error of not being able to open the Drawer? openDrawer()

sahil-foodbot commented 3 months ago

hi @sahil-foodbot Do you know the error of not being able to open the Drawer? openDrawer()

no have not tried that

tandler5 commented 1 month ago

hi @sahil-foodbot Do you know the error of not being able to open the Drawer? openDrawer()

no have not tried that

Any idea how to get it to work via Expo? Thanks in advance