Search Unity

Calling java/Android-SDK directly?

Discussion in 'Android' started by kristofe72, Sep 13, 2010.

  1. kristofe72

    kristofe72

    Joined:
    Sep 13, 2010
    Posts:
    1
    I know how to write native plugins for pc/mac/iOS but I am lost when it comes to doing it for Unity 3.0.0b7 - Android. Is there any documentation on how to do it? Anyone succeed in doing this yet?

    Specifically I need to send out an email from my android app. Since I already know how to do this using the Android SDK, integration is my problem.

    Any help will be greatly appreciated.

    Edit:
    I figured that I can call code because of the following lines in the release notes:

    Android Changes since 3.0.0b1:
    ...
    Added: Native (.so) and Java (.jar) plugins are supported through Assets/Plugins folder.
    Added: AndroidManifest.xml can be overridden in Assets/Plugins folder.
    ...

    So I am guessing that I just make a jar file and go through the normal plugin call methods.
     
  2. eriQue

    eriQue

    Unity Technologies

    Joined:
    May 25, 2010
    Posts:
    595
    There is some basic documentation to be found here: http://docwiki.unity3d.com/index.php?n=Main.Plugins#AndroidPlugins
    But for native plugins basically the same rules apply as using plugins with pc/mac. Java plugins are quite different though.

    Only native code can be called directly from C#; if you need to access Java you currently need to "route" the calls from C# through a native library (C/C++) to Java using JNI.