Ok, read a lot of post, seem sto be written correctly.
Here is the code:
in the application.xml we have
<!— Android Permisions —>
<android permission=“android.permission.WRITEEXTERNALSTORAGE” />
In our test function we have:
public static function testWrite( ):Bool
{
// Attempting to open/create the file:
var lfileOut:Dynamic = null;
trace(“write path and file: ” + SystemPath.applicationStorageDirectory + “test.dat” );
try {
lfileOut = File.write( SystemPath.applicationStorageDirectory + “test.dat”, true );
} catch ( perror:Error ) { return false; }
trace(“fileout ” + lfileOut + “.”);
if ( lfileOut != null )
{
trace( “Trying to get the uuid.”);
var ldeviceUID:String = Device.getUuid();
trace(“the uuid is: ” + ldeviceUID + “.” );
var ldeviceUIDLength:Dynamic = ldeviceUID.length;
trace(“The length of the UID is ” + ldeviceUIDLength + “.”);
lfileOut.writeString( ldeviceUIDLength );
trace(“The length of the UID is written.” );
lfileOut.writeString( ldeviceUID );
trace(“file was written.”);
lfileOut.close();
trace(“File was closed.”);
return true;
}
// If somthing went wrong we return false:
return false;
}
When we run it on the android we get this:
I/trace (23094): TestIO.hx:49: write path and file: openfl.utils.Sys
temPathtest.dat
I/trace (23094): Lib.hx:300: [fileopen,openfl.utils.SystemPathtest.dat]
I/trace (24692): TestIO.hx:49: write path and file: openfl.utils.Sys
temPathiaptoken.dat
I/trace (24692): Lib.hx:300: [fileopen,openfl.utils.SystemPathtest.dat]
I/trace (25827): IAPUnlockHelpers.hx:49: write path and file: /data/data/com.A
byss.test/filestest.dat
I/trace (25827): IAPUnlockHelpers.hx:54: fileout FileOutput.
I/trace (25827): IAPUnlockHelpers.hx:57: Trying to get the uuid.
I/trace (25827): IAPUnlockHelpers.hx:59: the uuid is: ************
I/trace (25827): IAPUnlockHelpers.hx:61: The length of the UID is 36.
I/trace (25827): Lib.hx:300: Null Function Pointer
Any ideas?
the problem is with using Dynamic. writeString() expects a string to be passed, you are however passing an Int as a Dynamic. You should convert the length into a string by either using Std.string() or var len = ldeviceUID.length + "";
--
To post to this group haxe...@googlegroups.com
http://groups.google.com/group/haxelang?hl=en
---
You received this message because you are subscribed to the Google Groups "Haxe" group.
For more options, visit https://groups.google.com/d/optout.
Big problem is why does the Try Catch not catch it for not making the file.
It comes back as a Type of “FileOutput” and so it passes a Null check.
We have tried byte, int, string
with lime clean application android
lime build application android
lime test application android
everything is the latest version with update and upgrade.