prevent android from dimming (w/ haxe and nme)

I’m going to do this in the easiest way I can think of. For anything more complicated, an NME extension would probably work well for this sort of thing!

After starting a new NME project in FlashDevelop, I created MainActivity.java in the project directory:

package ::APP_PACKAGE::;

import android.os.Bundle;
import android.view.WindowManager;

public class MainActivity extends org.haxe.nme.GameActivity {
	 protected void onCreate(Bundle state) {
		getWindow().addFlags( WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);

After that, I added a template entry to application.nmml:

<template path="MainActivity.java" rename="src/[package_path]/MainActivity.java" if="android" />

In my case, [package_path] was com/gigglingcorpse/test/dontdimm/.

Works for me at least!



  1. Franky says: