Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to make binding to Android method without parameters? #82

Open
gkmiel-hb opened this issue Feb 28, 2025 · 0 comments
Open

How to make binding to Android method without parameters? #82

gkmiel-hb opened this issue Feb 28, 2025 · 0 comments

Comments

@gkmiel-hb
Copy link

gkmiel-hb commented Feb 28, 2025

I am working on Firebase binding for Android. If I add method without parameters to java class, then it isn't visible from MAUI app (get error). If I add fake parameter to the same method, it becomes visible. Below is sample code with getString method

public class FirebaseSdk
{
    static FirebaseAnalytics mFirebaseAnalytics;

    public static void initializeSDK(Activity activity) {
    	Application application = activity.getApplication();

	// Obtain the FirebaseAnalytics instance.
	mFirebaseAnalytics = FirebaseAnalytics.getInstance(application);
    }

    public static void logEvent(String eventName, Bundle bundle) {
	mFirebaseAnalytics.logEvent(eventName, bundle);
    }

    // Invisible
    //public static String getString()
    //{
    //    return "result";
    //}

   // Visible
    public static String getString(String fake)
    {
        return "result";
    }
}

Error message for method without parameters:
error CS0117: 'FirebaseSdk' does not contain a definition for 'GetString'

P.s. Methods without returning something works fine:

    public static void resetAnalyticsData()
    {
        mFirebaseAnalytics.resetAnalyticsData();
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant