You use keytool
.
About half way down, Prepping for Release, shows you how:
http://www.steverichey.com/dev/openfl-android-tips-and-tricks/
You use keytool
.
About half way down, Prepping for Release, shows you how:
http://www.steverichey.com/dev/openfl-android-tips-and-tricks/
ah, ok.
My apps go to sleep after no activity. Just a guess, maybe you have something running in the background on a separate thread that keeps it active?
Which AndroidManifest.xml file did you edit? If you edit the one in you export/bin it won't work because that one is generated when the project is compiled. You need to make a template file and add a node in project.xml to tell the compiler to use that one. I did this a while ago, so I hope I remember.
I made a copy of C:\HaxeToolkit\haxe\lib\lime\2,9,1\templates\android\template\AndroidManifest.xml
(or similar, depending on your install location)
This is a copy of original:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="::APP_PACKAGE::" android:versionCode="::APP_BUILD_NUMBER::" android:versionName="::APP_VERSION::" android:installLocation="::ANDROID_INSTALL_LOCATION::">
<uses-feature android:glEsVersion="0x00020000" android:required="true" />
::if (ANDROID_PERMISSIONS != null)::::foreach ANDROID_PERMISSIONS::
<uses-permission android:name="::__current__::" />::end::::end::
<uses-sdk android:minSdkVersion="::ANDROID_MINIMUM_SDK_VERSION::" android:targetSdkVersion="::ANDROID_TARGET_SDK_VERSION::"/>
<application android:label="::APP_TITLE::" android:debuggable="::DEBUG::"::if (HAS_ICON):: android:icon="@drawable/icon"::end:: android:allowBackup="true" android:theme="@android:style/Theme.NoTitleBar.Fullscreen" android:hardwareAccelerated="true">
<activity android:name="MainActivity" android:launchMode="singleTask" android:label="::APP_TITLE::" android:configChanges="keyboardHidden|orientation|screenSize|screenLayout"::if (WIN_ORIENTATION=="portrait"):: android:screenOrientation="sensorPortrait"::end::::if (WIN_ORIENTATION=="landscape"):: android:screenOrientation="sensorLandscape"::end::>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="tv.ouya.intent.category.GAME" />
</intent-filter>
</activity>
</application>
</manifest>
By default I think there are four permissions allowed, but I don't remember what they are. I only wanted
INTERNET and ACCESS_NETWORK_STATE so I removed the part that allowed the defaults and added these two to my template.
This is what my template looks like:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="::APP_PACKAGE::" android:versionCode="::APP_BUILD_NUMBER::" android:versionName="::APP_VERSION::" android:installLocation="::ANDROID_INSTALL_LOCATION::">
::if WIN_REQUIRE_SHADERS::<uses-feature android:glEsVersion="0x00020000" android:required="true" />::elseif WIN_ALLOW_SHADERS::<uses-feature android:glEsVersion="0x00020000" android:required="false" />::end::
<!--Include required permissions for Google Mobile Ads to run-->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-sdk android:minSdkVersion="::ANDROID_MINIMUM_SDK_VERSION::" android:targetSdkVersion="::ANDROID_TARGET_SDK_VERSION::"/>
<application android:label="::APP_TITLE::" android:debuggable="::DEBUG::"::if (HAS_ICON):: android:icon="@drawable/icon"::end:: android:theme="@android:style/Theme.NoTitleBar.Fullscreen" android:hardwareAccelerated="true">
<activity android:name="MainActivity" android:launchMode="singleTask" android:label="::APP_TITLE::" android:configChanges="keyboardHidden|orientation|screenSize|screenLayout"::if (WIN_ORIENTATION=="portrait"):: android:screenOrientation="sensorPortrait"::end::::if (WIN_ORIENTATION=="landscape"):: android:screenOrientation="sensorLandscape"::end::>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="tv.ouya.intent.category.GAME" />
</intent-filter>
</activity>
</application>
<supports-screens
android:anyDensity="true"
android:smallScreens="true"
android:normalScreens="true"
android:largeScreens="true"
android:xlargeScreens="true" />
</manifest>
I save this template in the folder named templates
, above my projects folder so I can use it for all projects. So in project.xml
I add this node:
<template if="android" path="../templates/AndroidManifest.xml" rename="AndroidManifest.xml" />
Change the path if you put it somewhere else.
If you want to disallow the internet/network just remove those lines in the template.
I hope I remembered this and explained it ok.
Maybe FlxAtlas is what you're looking for?
https://api.haxeflixel.com/flixel/graphics/atlas/FlxAtlas.html
https://haxeflixel.com/demos/FlxAtlas/
I personally use C:\Users\Dean\AppDev\Games
and put the keystore file and my project folders all in there.
I don't think the desktop is a good place to work from. It's really just for shortcuts, which I have one to my Games/ folder.
I haven't done this for some time but was able to publish my apps to Google Play a couple of years ago.
keytool - the example I referenced used all lowercase for alias and keystore name. I don't have the link for it, sorry. I have an extra -v
in mine too, and the -validity you have is 100000. Try making it 10000, or 25 years. I didn't use -keysize.
keytool -v -genkey -v -keystore keysforallmygames.keystore -alias lockerraidcrew -keyalg RSA -validity 10000
Note that the keystore file is for all apps, so you should only make one and add the aliases and keys to it for each app. And keep it safe and make a backup. You'll need it to upgrade an app if you make any changes later. You can't upload the same app with a different key.
Project.xml (I keep my keystore file up a dir since it gets used for multiple apps)
<certificate path="../keysforallmygames.keystore" alias="lockerraidcrew" password="mypassword" if="android release" />
You should delete the export folder and build it new. The .build
file too (export/.build
). It gets incremented every build and all targets increment it. Google will use this build number and you need to make sure they increment and if you update your app, it must be > last build number. Just to keep in mind.
EDIT: I just edit my .build
file to equal the last version I published before I build an updated version so they are in succession.
Hope it helps.
For FlxUIButton
myButton.autoCenterLabel();
For FlxButton you can use labelOffsets
var btn = new FlxButton(50, 50, "Test");
btn.setGraphicSize(120, 45);
var labelY = (btn.height - btn.label.height) / 2;
btn.labelOffsets = [FlxPoint.get(0, labelY), FlxPoint.get(0, labelY), FlxPoint.get(0, labelY + 1)];
add(btn);
It was when resizing the window it went off. The solution was to use something like:
FlxG.signals.gameResized.add(updateSize);
...
function updateSize(width:Int, height:Int)
{
var oflScaleX = width / FlxG.initialWidth;
var oflScaleY = height / FlxG.initialHeight;
_textField.x = 50 * oflScaleX;
_textField.y = 50 * oflScaleY;
_textField.width = (FlxG.width - 100) * oflScaleX;
_textField.height = (FlxG.height - 100) * oflScaleY;
}
except the hard coded values should be the size/location you create it at. I just used those values for the example.
I think that works now unless I misunderstand the initialWidth/Height.