android - 使用 phonegap 回调 Android Intent

标签 android android-intent phonegap-plugins

我正在使用 phoneGap 框架开发一个 android 应用程序,在我的应用程序中我想发送一封电子邮件, 为此,我创建了一个 phoneGap 插件。 在插件中,我正在开始电子邮件 Activity 。 我在这里面临的问题是,我想在该 Activity (电子邮件)结束后立即调用一些功能。 那么如何实现呢??

插件方法是这样的:

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);
                 }

那么如何为电子邮件 Activity 添加回调函数。 这样该函数仅在 Activity 关闭时执行... ??

提前致谢..

最佳答案

您不能像使用相机 Intent 那样使用 onActivityResult 方法吗?

而不是像这样开始 Activity

启动 Activity ()

使用 startActivityForResult()

然后你重写 onActivityResult() 方法

关于android - 使用 phonegap 回调 Android Intent ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8641743/

相关文章:

android - PendingIntent 不适用于参数

cordova - Phonegap 3.0.0 日历插件

javascript - Phonegap 3.0 FileTransfer 下载不工作

android - 为什么gradlew :app:dependencyInsight fail?

android - 如何清除 EditText 中的选择?

android - 在 Eclipse 中更改最低 SDK 版本时更改 android.jar 源?

android - 如何从相机 Intent 中获取图像路径?

android - 来自 LiveWallpaper 服务 Android 的 startActivityForResult

javascript - Pushwoosh phonegap 插件,检索设备 ID

android - 在代码中更改 ImageButton 边距