2

Forgive me because I don't really know where to ask this question, but I assume it would be really helpful to a lot of people to know the answer. If I shouldn't have asked it here, please redirect me to a better site to ask it at. Thank you.

Anyway, so I use Parse in a lot of my applications particularly on Android and web-based apps as a backend for data. It's a great service and they provide great documentation, and I love it. However, I recently switched from native java on android to C# with Xamarin.Android. I was very happy to find that Parse had an existing sdk for Xamarin.Android apps! Unfortunately, I needed Push Notification functionality which hadn't been implemented in that sdk, but had been well documented and maintained in the native java/android sdk for Parse.

So after reading every comment on Parse's forums about my issue, I looked into binding the java/android libraries from Parse to Xamarin's C# for Android, because it seemed to be the only solution other than using their REST API. Xamarin has a really nice tool for binding java to C#, but, and I could be wrong, my understanding is that the Xamarin binding tool must be decompiling the java source from the native android parse sdk, parsing through it, and then creating C# wrappers around it.

However, if you go onto Parse's site and look at their license, it says that Parse's code cannot be decompiled. On the other hand, when you go onto Xamarin, they have iOS bindings for Parse that they appear to have binded themselves to C#, and are distributing it on Github. Also, on Parse's forums whenever someone suggested to bind the sdk, no one ever responded saying that it wasn't allowed.

So my questions are:

How is it possible that Xamarin can bind libraries without decompiling the native java?

Is it legal to bind the Parse/Android sdk from java to C# and use it in a production application or distribute it?

Thanks again!

4
  • Your second question seems to assume that publicly available licenses are the only kind of license one might get. Presumably the folks at xamarin have a contract with parse.com Commented Aug 11, 2014 at 17:31
  • Ah interesting. That would clear things up. But it still doesn't explain why Parse wouldn't outlash when they saw that people were doing that. Commented Aug 11, 2014 at 17:33
  • Using the bindings provided by Xamarin under contract? Again, this is speculation, but I would guess it's because they're allowed under the contract. Commented Aug 11, 2014 at 17:35
  • No I mean there were two separate people who suggested doing it on Parse's forums to the public and there was no response from any Parse rep. I guess they could have contracts too? Commented Aug 11, 2014 at 17:36

1 Answer 1

3

As i know Java Binding Libraries decompile nothing. It creates a binding project that automatically wraps the library with C# wrappers based on a declarative approach. It wraps only public classes and methods.

Here is example of generated wrapper code for YouTubePlayer

[Register ("com/google/android/youtube/player/YouTubePlayer", "", "Google.Android.Youtube.Player.IYouTubePlayerInvoker")]
public partial interface IYouTubePlayer : IJavaObject {

    bool HasNext {
        // Metadata.xml XPath method reference: path="/api/package[@name='com.google.android.youtube.player']/interface[@name='YouTubePlayer']/method[@name='hasNext' and count(parameter)=0]"
        [Register ("hasNext", "()Z", "GetHasNextHandler:Google.Android.Youtube.Player.IYouTubePlayerInvoker, Google.Android.Youtube.Player")] get;
    }

    bool HasPrevious {
        // Metadata.xml XPath method reference: path="/api/package[@name='com.google.android.youtube.player']/interface[@name='YouTubePlayer']/method[@name='hasPrevious' and count(parameter)=0]"
        [Register ("hasPrevious", "()Z", "GetHasPreviousHandler:Google.Android.Youtube.Player.IYouTubePlayerInvoker, Google.Android.Youtube.Player")] get;
    }

    bool IsPlaying {
        // Metadata.xml XPath method reference: path="/api/package[@name='com.google.android.youtube.player']/interface[@name='YouTubePlayer']/method[@name='isPlaying' and count(parameter)=0]"
        [Register ("isPlaying", "()Z", "GetIsPlayingHandler:Google.Android.Youtube.Player.IYouTubePlayerInvoker, Google.Android.Youtube.Player")] get;
    }

    // Metadata.xml XPath method reference: path="/api/package[@name='com.google.android.youtube.player']/interface[@name='YouTubePlayer']/method[@name='addFullscreenControlFlag' and count(parameter)=1 and parameter[1][@type='int']]"
    [Register ("addFullscreenControlFlag", "(I)V", "GetAddFullscreenControlFlag_IHandler:Google.Android.Youtube.Player.IYouTubePlayerInvoker, Google.Android.Youtube.Player")]
    void AddFullscreenControlFlag (int p0);

    // Metadata.xml XPath method reference: path="/api/package[@name='com.google.android.youtube.player']/interface[@name='YouTubePlayer']/method[@name='cuePlaylist' and count(parameter)=1 and parameter[1][@type='java.lang.String']]"
    [Register ("cuePlaylist", "(Ljava/lang/String;)V", "GetCuePlaylist_Ljava_lang_String_Handler:Google.Android.Youtube.Player.IYouTubePlayerInvoker, Google.Android.Youtube.Player")]
    void CuePlaylist (string p0);

    // Metadata.xml XPath method reference: path="/api/package[@name='com.google.android.youtube.player']/interface[@name='YouTubePlayer']/method[@name='cuePlaylist' and count(parameter)=3 and parameter[1][@type='java.lang.String'] and parameter[2][@type='int'] and parameter[3][@type='int']]"
    [Register ("cuePlaylist", "(Ljava/lang/String;II)V", "GetCuePlaylist_Ljava_lang_String_IIHandler:Google.Android.Youtube.Player.IYouTubePlayerInvoker, Google.Android.Youtube.Player")]
    void CuePlaylist (string p0, int p1, int p2);

    // Metadata.xml XPath method reference: path="/api/package[@name='com.google.android.youtube.player']/interface[@name='YouTubePlayer']/method[@name='cueVideo' and count(parameter)=1 and parameter[1][@type='java.lang.String']]"
    [Register ("cueVideo", "(Ljava/lang/String;)V", "GetCueVideo_Ljava_lang_String_Handler:Google.Android.Youtube.Player.IYouTubePlayerInvoker, Google.Android.Youtube.Player")]
    void CueVideo (string p0);

You can learn more from architecture description and java binding description

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.