1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[Flutter] Flutter application restart instead of resuming after invoking method from native...

Discussão em 'Mobile' iniciado por Stack, Outubro 3, 2024 às 12:32.

  1. Stack

    Stack Membro Participativo

    I currently doing payment integration in Flutter using native Android. I manage to get the results from the payments side, I then proceed to return the result into my invoking flutter file.

    Here is the passing of my code to my invoking flutter file.

    Intent returnIntent = new Intent(getApplicationContext(), BackToMerchantActivity.class);
    returnIntent.putExtra("resultTitle",resultPaymentMessage.getStrResultTitle());
    returnIntent.putExtra("resultInfo",resultPaymentMessage.getStrResultInfo());
    returnIntent.putExtra("resultExtra",resultPaymentMessage.getStrResultExtra());

    startActivity(returnIntent);
    finish();


    Here is my invoking methods

    class BackToMerchantActivity: FlutterActivity() {
    private val CHANNEL = "my.com.ipay88.ipay88payment/backToMarchant"
    private lateinit var _result: MethodChannel.Result

    override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    GeneratedPluginRegistrant.registerWith(this)
    print("Enter Back To Merchant \n");

    val resultTitle: String = intent.getStringExtra("resultTitle") ?: ""
    val resultInfo: String = intent.getStringExtra("resultInfo") ?: ""
    val resultExtra: String = intent.getStringExtra("resultExtra") ?: ""

    print("Result title : " + resultTitle +" \n");
    print("Result Info : " + resultInfo +" \n");
    print("Result Extra : " + resultExtra +" \n");

    MethodChannel(flutterView, CHANNEL).invokeMethod("my.com.ipay88.ipay88payment/backToMarchant", mapOf("resultTitle" to resultTitle, "resultInfo" to resultInfo, "resultExtra" to resultExtra));
    }

    }


    The results is able to into invoking files as I am able to print it out. However the invoking flutter application from native Android will restart the whole Flutter application instead of resuming the application. Please help as I been stuck here for a week. Any tips would be really appreciated

    Continue reading...

Compartilhe esta Página