Android Question How to implement this?

EduardoElias

Well-Known Member
Licensed User
Longtime User
I am having trouble to start this

I have a new POS system with a printer that is part of it. THey say the way access it is by

import com.elgin.e1.Impressora.Termica

However they do no provide any file.

Could it be a Intent Service? if so how could I access it?

They provide an example for Java: compiling it on B4A does not work since this import is not found.

I am lost.


B4X:
// ...
 
import acom.elgin.e1.Impressora.Termic;
 
public class MainActivity extends AppCompatActivity { // AppCompatActivity e' um subtipo de Activity
 
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
 
        Termica.setContext(this);
        Termica.AbreConexaoImpressora(6, "M8", "", 0);
    }
 
    @Override
    protected void onDestroy() {
        super.onDestroy();
        Termica.FechaConexaoImpressora();
    }
 
    // Essa funcao pode ser chamada em um botao, por exemplo
    private int Avanca50linhas() {
        int retorno = Termica.AvancaPapel(50);
        return retorno;
    }
}
 
// ...
 

EduardoElias

Well-Known Member
Licensed User
Longtime User
I have found a little help, extracting from an java example used on this device:

B4X:
    Intent iPrinter = new Intent("com.elgin.e1.intentservice.IMPRESSAO");
    iPrinter.putExtra("direta", "OLA MUNDO");

    startActivityForResult(iPrinter, 1);

I have tried the following:

B4X:
    Dim i As Intent
    i.Initialize("com.elgin.e1.intentservice.IMPRESSAO", "")
    i.PutExtra("direta", "OLA MUNDO\n")
    StartActivityForResult(i)

It did not give any error, but did not work, But seems I need to call startActivityForResult passing one more paramenter '1' to be understood
 
Upvote 0
Top