Skip to main content
February 1, 2013
Answered

ANE for one platform on Flex mobile project for iOS and Android

  • February 1, 2013
  • 2 replies
  • 674 views

I'm very new at Flex Mobile Projects and native extension.

I have a big doubt... If I have an ANE that only works on iOS or Android, can I use it into a project for Android AND iOS?

I mean, if I want to do something and I've only found and ANE that works for iOS and another ANE that works for Android, can I create only one project and depending on the device use one or another? or should I create two different projects?

Thanks in advance

This topic has been closed for replies.
Correct answer Mark.fromOP

You can set them both up and when you publish just comment out the code that does not apply, this way you still keep it as one project but you can use the ANEs as needed, I had to do this with the iAd ANE only for Apple obviously and AdMob ANE which at the time was Android only.

Example

//Android ANE Code
blah blah blah
//iOS Code
code code code

Now when you publish for iOS comment out the Android related stuff

//Android ANE Code

/*

blah blah blah

*/

//iOS Code

code code code

Also dont forget to update your included ANEs when you publish and remove the ones that dont apply and update the XML files as needed. Its possible, but annoying, it would be nice if it was automated or could be flagged somehow so the Flash publisher would auto ignore it.

2 replies

Known Participant
January 26, 2014
Mark.fromOP
Mark.fromOPCorrect answer
Inspiring
February 3, 2013

You can set them both up and when you publish just comment out the code that does not apply, this way you still keep it as one project but you can use the ANEs as needed, I had to do this with the iAd ANE only for Apple obviously and AdMob ANE which at the time was Android only.

Example

//Android ANE Code
blah blah blah
//iOS Code
code code code

Now when you publish for iOS comment out the Android related stuff

//Android ANE Code

/*

blah blah blah

*/

//iOS Code

code code code

Also dont forget to update your included ANEs when you publish and remove the ones that dont apply and update the XML files as needed. Its possible, but annoying, it would be nice if it was automated or could be flagged somehow so the Flash publisher would auto ignore it.