Announcement

Collapse
No announcement yet.

Help with accessing Android sensors through JNI - Failed to find method

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Help with accessing Android sensors through JNI - Failed to find method

    Essentially, I am trying to get TYPE_ROTATION_VECTOR values from an android tablet device using JNI and pass them through to a blueprint. Before trying to do this my experience with code was non-existent, so the rest of the project has been built in blueprints. The goal of the project is to use the tablet to view HDRI spheres like google street view or other 360 degree image viewing apps.

    I have cobbled a plugin together by attempting to understand the source code of an app called Sensor Fusion Demo (particularly its Rotation Vector Provider) and going by this tutorial: http://isaratech.com/ue4-making-a-an...in-10-minutes/ - The idea is to use an APL.xml file to extend GameActivity.Java

    The current error causing the app to crash is triggered on launch once the splash screen exits. It reads:
     
    Spoiler


    Followed by a bunch of Callstack errors:

     
    Spoiler


    This is the code in AndroidJNI.cpp it's referring to, line 189 being CHECK_JNI_RESULT(Method);

     
    Spoiler


    This is my Function Header:

     
    Spoiler


    This is my .cpp file:

     
    Spoiler



    And here is the APL.xml file:

     
    Spoiler


    Any assistance here will be massively appreciated. I am a novice at coding in general and have been quite dismayed by my lack of finding solid working examples of this being achieved before.

    #2
    Hi, do you have any error message during the packaging of the application?

    Comment


      #3
      Update: I discovered the issue was I had not added the APL as a module dependency in the build.cs file. The app basically didn't know it existed.
      Originally posted by IsaraTech. View Post
      Hi, do you have any error message during the packaging of the application?
      No, they came up only when it ran. Probably because the code was set to run only on Android. But still, I found the cause, thanks for your help.

      Comment


        #4
        HolyDuckTurtle Can I ask you for any resourses that I can learn JNI and warping inside unreal?

        I really got tired doing this, bec I want to access microphone data directly and bypassing unreal engine API with that. and i'm unable to get any resources to start with .

        Comment


          #5
          Hi,

          Ive managed to get this working on Unreal 4.23.1 with the light sensor and also pressure sensore but cant get it working with Sensor.TYPE_ROTATION_VECTOR, X Y and Z of the vector are all 0.0. is ther any kind of permission or somthing else that i need to enable?

          thanks

          Spriggsy

          Comment


            #6
            For those who come across this post I suggest using this plugin and calling Java code with a single line of code: https://forums.unrealengine.com/comm...ne-4-jni-obj-c

            Comment

            Working...
            X