Loading config file in android

Post here your questions about the Java client / Android API for SFS2X

Moderators: Lapo, Bax

brendan7
Posts: 43
Joined: 10 Feb 2014, 17:40

Re: Loading config file in android

Postby brendan7 » 01 Apr 2015, 15:23

Does anybody know the default location for sfs-config.xml on android?
User avatar
Lapo
Site Admin
Posts: 20219
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Loading config file in android

Postby Lapo » 01 Apr 2015, 16:41

I have no idea. It should be packed in the .apk file, but I am not sure.
In our Android examples we don't use an external config file. It's not even useful, since there's no way (or need) to change it after the code is compiled, so it's useless.

You can simply create a ConfigData object and populate the config directly from code, before connecting.

Then use the SmartFox.connect(ConfigData cf) and you're done.

Cheers
Lapo
--
gotoAndPlay()
...addicted to flash games
brendan7
Posts: 43
Joined: 10 Feb 2014, 17:40

Re: Loading config file in android

Postby brendan7 » 01 Apr 2015, 20:05

Thanks for the advice, I hadn't noticed the ConfigData object.

I had needed sfs-config.xml because file upload getHttpUploadURI() returns null in java without an httpPort configured, but it looks like one can set the httpPort in the ConfigData object and it works.

If anybody still needs to use the config file on android, I had a solution where I copied the file from the local folder to an absolute path upon initial install of the app, which ended up working fine. But now I'm switching to ConfigData as it is easier to deal with.

Return to “SFS2X Java / Android API”

Who is online

Users browsing this forum: No registered users and 1 guest