• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

native extension for android - get context

I

IcecreamPie

Guest
Hi I'm pretty new at android programming and I've been trying to make a native extension for android

I've been looking for a way to get context (in order to access VIBRATOR_SERVICE)
I've searched extensively and found that some people use:
Code:
RunnerJNILib.GetApplicationContext()
I would like to ask:
Would someone please explain why this works?
How do we know that RunnerJNILib can run the GetApplicationContext() function?
I've googled everywhere, and I couldnt find any official documentation on RunnerJNILib

Thank you so much, I really appreciate your help as I'm still learning :)
 

2Dcube

Member
I personally used
Code:
RunnerActivity.CurrentActivity.getApplicationContext()
but I suppose the above might work too.

How do we know? Because these are classes that YoYo uses for Game Maker games to run on Android, and unless they change it in the future it should keep working.

To get access to RunnerJNILib I seem to have used
Code:
import com.yoyogames.runner.RunnerJNILib;
And for the RunnerActivity:
Code:
import ${YYAndroidPackageName}.RunnerActivity;
There is not much documentation on YoYo's native Android or iOS code so a lot is done by looking at what we can see and trying things (at least in my case).
 
I

IcecreamPie

Guest
Sorry for the super late reply, but thanks heaps for your answer, it's really interesting! :D
Much appreciated! :D
 
Top