Call back for Android using phone interchange

I am developing an Android application using the phoneGap framework. In my application, I wanted to send an email. For this, I created a phoneGap plugin. In the plugin, I start working with email. The problem that I am facing is that I want to call some functions immediately after this operation is completed (by email). So how to achieve this.

The plugin method is as follows:

public PluginResult execute(String action, JSONArray args, String callbackId) { try { if (action.equals("startActivity")) { Intent i=new Intent(action); // code for email.... this.ctx.startActivity(i); //call back function here ...??? return new PluginResult(PluginResult.Status.OK); }catch (JSONException e) { e.printStackTrace(); return new PluginResult(PluginResult.Status.JSON_EXCEPTION); } 

So how to enable callback function for email activity. So the function is executed only when the activity is closed ... ??

Thanks in advance.

+4
source share
1 answer

You cannot use the onActivityResult method in the same way as you use for camera intent, for example?

instead of starting activities like

startActivity ()

use startActivityForResult ()

then you will override the onActivityResult () method

0
source

Source: https://habr.com/ru/post/1388090/


All Articles