The mobile phone project development market is booming and various technologies are emerging. As a front-end program that has been following flash for many years, the Adobe AIR technology gives us a glimmer of light (a huge array of xdd), and there are already many successful cases in the gaming field, and the effect is no less than that of native language development applications.
However, even the best technology has its shortcomings. Currently, AIR provides limited support for the underlying features of mobile devices, and many IOS/Android public functions are not supported. fortunately, Adobe provides a good solution, namely, Ane (Air native extensions), which serves as a bridge between devices and air.
The following describes some precautions for creating and releasing a mobile project containing ANE in flashdevelop (FD:
Of course, first you need the necessary ane file. The following address describes how to create your own ane file:
Http://help.adobe.com/en_US/air/extensions/index.html
You can also directly use the ANE provided by a third party (including the official website of Adobe)
Http://www.adobe.com/devnet/air/native-extensions-for-air.html
With the ANE file, you can apply some features that are not supported by the air native in the mobile project. The following are some precautions (the notification and vibration eane in the above address are used in the example ):
- Introduce ANE:
Copy the ANE file to the project directory (generally in the lib or ane folder), right-click and choose add to library.
- Modify the ANE introduction method:
Right-click the ANE file-> options..., and change it to external library (not supported DED );
- Modify the application. XML description file to introduce ane support:
In this example, two ane files are introduced, so you need to add the following code:
<Extensions> <! -- Vibration ANE's extension id --> <extensionid> com. Adobe. Vibration </extensionid> <! -- Extension ID of notification ane --> <extensionid> com. Adobe. Mobile </extensionid> </extensions>
Of course, FD 4 also provides UI support for this purpose. click the button shown in Figure 1 To Go To The extensions tab (Figure 2) for editing.
(Figure 1)
(Figure 2)
- Add some additional support descriptions:
In this example, you need to add a permission description for vibration, and add a service description for notification (related descriptions are provided on the corresponding ane download page). You can directly modify the application. set XML or in the interface mentioned above (figure 3)
(Figure 3)
- Modify the packaging batch processing command:
The compilation and packaging process of FD is implemented through batch processing. To add ane support, You Need To slightly modify the packager. BAT file,
Add-extdir lib/after % file_or_dir % (without line feed), and Lib is the relative path of the ANE directory.
In this example, We will test part of the ANE code (just put it in the document class constructor ):
// Implement if (vibration. issupported) {var V: Vibration = new vibration (); V. vibrate (2000);} // system reminder try {var Nom: icationicationmanager = new icationicationmanager () ;}catch (ERR: Error) {return;} var N: notification = new notification (); N. tickertext = 'text displayed in the status bar during reminder '; N. title = 'alert title'; N. body = 'and content'; // reminder icon type N. icontype = icationicationicontype. info; nom. policyuser ('My _ policy_type ', N );
Basically, you need to pay attention to this. Now you can test it on the device. It may happen that after the program is run, a prompt appears on the status bar while the mobile phone is shaking, open the status bar to see a notification with the info icon and title and content.
-EOF-