如何从 android 传递 KonyMain.getActivityContext() for kony ffi

How to pass KonyMain.getActivityContext() from android for kony ffi

请检查下面的代码

package com.firebaseio.httpsfirbasenosql.auth;

import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.net.Uri;

public class AuthClass {


    public static void callAuth(Context con, String url) {
        boolean isAppInstalled = appInstalledOrNot(con,"com.android.chrome");


        if(isAppInstalled) {

            Intent intent=new Intent(Intent.ACTION_VIEW,Uri.parse(url));
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            intent.setPackage("com.android.chrome");
            try {
                con.startActivity(intent);
            } catch (ActivityNotFoundException ex) {
                // Chrome browser presumably not installed so allow user to choose instead
//                Log.i("Auth","ActivityNotFoundException");
                intent.setPackage(null);
                con.startActivity(intent);
            }

        } else {
//            Log.i("Auth","Application is not currently installed.");
            Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
            con.startActivity(browserIntent);
        }
    }

    private static boolean appInstalledOrNot(Context con, String uri) {

        PackageManager pm = con.getPackageManager();
        try {
            pm.getPackageInfo(uri, PackageManager.GET_ACTIVITIES);
            return true;
        } catch (PackageManager.NameNotFoundException e) {
        }
        return false;
    }
}

我从 Kony App 调用了带有 2 个参数的 callAuth 函数, 第一个参数是上下文和第二个字符串。

请帮助我如何从 kony 应用程序调用上下文或如何在 android 静态 class.

中调用 kony 上下文

您不必传递上下文。您始终可以使用 KonyMain.getActivityContext() 获取它。为此 class,您必须将 konywidgets.jar 添加到您的构建路径或依赖库中。 您可以在以下路径中找到此 jar 文件:/temp//build/luaandroid/dist//libs