Writing android native plugin

So, i want to write android native plugin to get some stuff from android, like system uptime and so on. I was using this tutorial http://www.lorenzonuvoletta.com/how-to-create-a-native-android-plugin-for-unity/ , and it worked good, but this tutorial is pointless as many others, because it doesnt really use anything from android, its just yet another tutorial done in wrong way. I wanted to get some stuff from android, so i imported android.os.SystemClock to my java android plugin, and tried to return SystemClock.elapsedRealtime(), but it didnt do anything. Maybe someone know how to write android native plugins in java for unity or what is wrong with that tutorial ?

What do you mean “it didn’t do anything”? Can you elaborate?.. That tutorial is perfectly fine. All it is showing is how to call Unity functions from Java and vice-versa.

As is written in tutorial, example just sends random number to java plugin, plugin then calls method from unity and it return that random number, and that thing worked good, but when i changed return value in java plugin, it didnt return anything.

Edit : after like 10 more tests and recompiles, it started working. I dont know what happened, but now it works and java plugin returns value from android native function.

You might want to take a look at this tutorial:

How to make Android Plugin for Unity: Take photo from camera and gallery

The demo plugin takes photo from Camera/Gallery and returns image data to Unity.