AIR GeoLocation Mute problem

If you are searching for gelolocation.mute always true problem from AIR 16. I come across same issue and solved using local storage.

What I did is, Only first time after installation of app I will not check geolocation.mute and use update handler only. Next time always I will use .mute property and handle accordingly.

Please leave your comment if below code help you.

1. in Application XML add under InfoAdditions

<key>NSLocationWhenInUseUsageDescription</key>
<string>Enable Location Service : Only When Application is Active</string>

Or

<key>NSLocationAlwaysUsageDescription</key>
<string>Enable Location Service : Always</string>

2. Init geolocation variable in Application class in Init or preinit

public var geo:Geolocation;
protected function preinitializeHandler(event:FlexEvent):void
{
geo = new Geolocation();
}

3. In your geolocation class (if you have separate or in Application as per your project requirement)

public function getCurrentLocation()
{
// Check Geolocatin is supported in device

if (Geolocation.isSupported)
{
// Getting Data from Local Shared Object and checking if we are using geolocation support first time.
// You need to write code for sharedObj functions. those functions are not incldued here
var localObj:Object = new Object();
localObj = sharedObj.LoadData();

// Make sure no Null Error
if(localObj.isFirstTimeGeoLocationChecking == null)
localObj.isFirstTimeGeoLocationChecking = true

if(localObj.isFirstTimeGeoLocationChecking == true)
{
// First time after app installation we will just call Update Handler
FlexGlobals.topLevelApplication.geo.addEventListener(GeolocationEvent.UPDATE, updateHandler);
// Lets make the local shared object variable to false
localObj.isFirstTimeGeoLocationChecking = false;
// Save Data to Local Shared Object
sharedObj.SaveData(localObj);
}else if (FlexGlobals.topLevelApplication.geo.muted )
{
showErrorPopup(true,”Service Disabled”,”Please enable location services on your device via Settings > Privacy > Location Services >”);
}else
{
geo.addEventListener(GeolocationEvent.UPDATE, updateHandler);
}
} else
{
showErrorPopup(true,”Error”,”Location Service not supported”);
showHideLoadingPopup(false);
}
}

 

Advertisements

How to Upload a PDF from PC, without browse / fileReference

Action Script 3 + PHP + IOS

This is AS3 code for AIR. To upload a PDF file from desktop or from IOS email attachment to server. This code is tested, inside Flash Environment and on IE/Chrome/Safari.

I face Error#2038, But I have not added any .htaccess File not I have added any other. Only make sure you have write Rights on the “upload” folder. The PHP code will create “files” folder itself. and give write permission also. But the root folder should have same 777 Rights.

AS3/AIR code

// Add Cross Domain Path
Security.loadPolicyFile(“crossdomain XML Path”);

Call function loadPDFFileFromDesktop if you want to upload Files from Desktop PC

// Upload PDF from Desktop
Private Function loadPDFFileFromDesktop()
{
var fileUploadObj:ImageUpload_Iphone = new ImageUpload_Iphone(this);
readMediaData("D:\\myPdfFiles\\Ritesh_CV.pdf"); // Add Double Slash
}

When You, press on any PDF file on IOS, it will show you “OPEN IN” menu. Tap on your APp to open PDF in Your App. Make sure you have Registered Custom File Type in IOS.  Then only your App will be displayed under “OPEN IN” menu. read more at Register Custom File Type in IOS. In our case PDF should be registered.

open-in2[1]

The Application will be invoked when you tap in “OPEN IN” menu of IOS. To Register invoke Command lets add Event-Listener for the same. Make sure this should be in Main Function of the Application.

NativeApplication.nativeApplication.addEventListener(InvokeEvent.INVOKE, loadPDFFileFromMobile);

// Upload PDF from mail attachment from IOS
Private Function loadPDFFileFromMobile(e:InvokeEvent)
{
//e.arguments[0] - will give you file path of the Temporary Path,
fileUploadObj.readMediaData(e.arguments[0]);
}

Read More detail on Arguments of InvokeEvent at Adobe

Lets Read The File and Upload it

Private function readMediaData(filePath:String):void
{
private var serverUrl:String = "Enter Upload.php Server URL here";
var prefsFile:File = new File(filePath);
prefsFile.addEventListener( Event.COMPLETE, uploadComplete );
prefsFile.addEventListener( IOErrorEvent.IO_ERROR, ioError );
prefsFile.addEventListener( ProgressEvent.PROGRESS, progressHandler );
prefsFile.upload(new URLRequest( serverUrl ));
}

private function uploadComplete(e:Event):void
{
trace("uploadComplete.");
}

private function ioError(e:IOErrorEvent):void
{
trace("ioError " + e );
}

private function progressHandler(e):void
{
trace("Uploading... " + Math.ceil(100*(e.bytesLoaded/e.bytesTotal)));
}

PHP Code

//create the directory if doesn't exists (should have write permissons)
if(!is_dir("./files")) mkdir("./files", 0755);
//move the uploaded file
move_uploaded_file($_FILES['Filedata']['tmp_name'], "./files/".$_FILES['Filedata']['name']);
chmod("./files/".$_FILES['Filedata']['name'], 0777);

We are good To Go test It, and give me feedback if this works.

Spaceport NEO

Spaceport NEO

http://spaceport.io/

The free, cross-platform mobile game framework using ActionScript 3.

Featurs

  • Familiar Tools & APIs
    Develop on Mac OS X or Windows
    Develop entirely in Adobe FlashBuilder
    Create art assets with Flash Professional
    Integrate with Flash API & SWC files
    Debug / Profile using Flash Builder
  • Super-Simple Workflow
    No need for Xcode or Android SDK
    Install to iOS and Android via USB
    Update code and assets over WiFi
    Easily export IPA & APK files
    Update live games via Spaceport Cloud
  • High-Performance Graphics
     Fully GPU-accelerated without Stage3D
     Dramatically faster rendering than AIR
     Vector Graphics without the slowdown
     No need for sprite sheets
     Unrestricted animation length & size
     

How SP works

sp is built on an incremental build system called Shake.

Inside your project folder, there is a hidden file called .actionScriptProperties. This file is created by Adobe Flash Builder. It contains information about project configuration.

sp will automatically read the .actionScriptProperties file to determine your project configuration. Next, it will build all of your resources. It will convert:

  • All your ActionScript code to JavaScript
  • All SWF and SWC files containing artwork to SGF files (Spaceport Graphics Format)
  • All MP3 files to OGG files (no legal issues)

It will also create a file called manifest.xml which enumerates all of the files in the project. This is used to detect which files have changed, so that only the differences are downloaded between runs.

All other resources included in the project, like TXT, JSON, XML, PNG, JPG, and GIF files will be copied into the bundle.

All of these things created by the sp tool will be placed inside a folder called out. If you ever delete this folder, everything inside will be rebuilt.

Humming Bird

Humming Bird

http://www.flashapi.org/hummingbird/

Hummingbird is the easiest way to build and deploy robust MVC applications for ActionScript 3.0, mobile and the Starling Framework.

Hummingbird is Free & Open Source, released under Simplified BSD License.

With Hummingbird, you can leverage a strong and efficient MVC architecture for cross-platform mobile development:

 

Hummingbird enables you to focus on the quality of your applications rather than the plumbing that connects components and systems.

Features

  • Ease of use

The Hummingbird framework comes with a huge bunch of built-in functionalities, such as ready-to-use templates, ant builder tasks, sample projects and more…

Because Hummingbird uses Inversion of Control (IoC) and Dependency Injection (DI) to deal for you with the MVC pattern architecture, you just have to focus on the business layer of your applications, or games

  • Productivity

Contrary to others signal-based MVC framewoks, Hummingbird strictly adheres to the MVC pattern. It means that developers can easily identify producers and consumers of action calls between the actors of the MVC pattern.

  • Portability

The Hummingbird framework has been designed to work with all of the technologies highlighted by the Adobe Gaming team, including Starling and the AIR SDK. Furthermore, the Hummingbird framework is fully compatible with both, Flex Apache and Flex Mobile, frameworks.

  • Modularity & Company Workflows

By completely decoupling the good old MVC triad, Hummingbird keeps your code concise, simple and modular.

Thus, it easily enables teams management and maintainability of code.

 

Flurry Analytics ANE for Mobile Devices

This is replacement of Google Analytics for Mobile Plateform.

Create a Account on Flurry .

Create a Application of Ios/Android. Both must be different.
Take the ID and use it in code. Add the ANE in Project.

Write below code into your Main function in document class.


//Set up the version as per your App XML
Flurry.setAppVersion("0.1");
// Paste the ID of your app on Flurry
Flurry.startSession(flurryId);

So, you init the Flurry in your Application. Now where ever you want to add some Event. you can call below code


Flurry.logEvent("Name of event", {parameter1 : value1, parameter2 : value2 });
// For Example
// Flurry.logEvent("Login", {parameter1 : "Ritesh Newal"});

Once you run the app, and you aware that you run through above event. You now need to wait for 3-5 Hours. Flurry take this much time to update.

ANE [AIR Native Extension] : What, Why & How

AIR Native extension
An ANE is a combination of Action Script and Native code. Air applications run in a protected environment (sandbox), and because of that such application doesn’t have full access to the system resources like HDD, OS support, connect to other installed application.

The native extension interface allows native code to run still keeping the Air security model. You can imagine ANE as a bridge between device and AIR. One side is Flash AIR and second side is device OS, like Ios, Android and blackberry. ANE is created using a C/C++ shared object code Or device specific native code. This code contains some functions that act as an entry-point.

In more simple language.
You can understand like ANE is a class with some private function and some public functions. Viola you understand then nothing is hard now. What you do with a class? Init the class, create object of that and call public function using object. Correct?

A ANE developer create a ANE and a SWC. ANE contains public entry point and private functions to complete a specific task. And SWC contains Action script communicates with ANE and your project.

Why to use ANE:
As updated above AIR cannot talk to device’s OS directly. Here ANE help user to complete certain task.
Second thing is, some of the Application or Website does have their SDK which can be use in native languages but they do not have any SDK for AIR. Like Google Admob, Flurry, Google Analytics, Widespace ad network, facebook single login service, and many more. Here also ANE help AIR developer. Create ANE using SDK for specific task and use it in AIR.

Some ANE’s
• Flurry
• AdMob
• Contact Editor
• Device Info
• Facebook Single user login
• Push notification
• Vibrate
• Native pop-up dialog
• Salience switch
• InApp purchase
• Email extension

Steps to use a ANE
1. Add ANE in Flash Builder
2. Change APP XML and add your extension (mostly this step does not need any manual work when you complete step 1 it automatically done.)
<extensions>
<extensionID>com.sticksports.nativeExtensions.SilentSwitch</extensionID>
</extensions>
3. Add Swc if any in flash builder
4. Init the ANE/SWC
5. Add the code.

A good resource of free ANE I found is http://extensionsforair.com/

But yes, If you want proper support and trusted ANE, you should check milkmangames. The amount of Android, IOS or Combo for every ANE is different here.

Ritesh Newal

AIR for Android

Adobe AIR is officially released for the Android. Adobe Developers can start development and make profit from their AIR applications for the Android users. It is very exciting news for the developers who engage in Continues Development for Mobile Devices. Some Helpful links are mentioned below as a Starter before the Dinner 🙂

A Video from Mr. Lee Brimelow to download an AIR application and runtime Click Here

A Video from Mr. Lee Brimelow to Publishing AIR for Android Applications Click Here

Adobe AIR for Android Click Here 

Lets Start swimming in Android.

Flash Media Server 4

On September 9th 2010, Adobe launched Flash Media Server 4. FMS is the industry leading software for Streaming Video and Real-Time Communication.  New feature includes Full 64-bit support, Enhanced buffer, HTTP Dynamic Streaming, IP multicast, Application-level multicast, Mobile delivery to Adobe® Flash® Lite™ 3 and many more :).

So Live Training Events, eLearning, Remote Speakers, Sport Broadcast, Desktop Media Player with Live Stream, Live Conference, Live Support, Live Remote Interviews ♥, Product Demos and many more applications are on the way with better efficient Video Encoding and Rich Streaming without any Pause in between.

User can choose according to his requirement by Help me to choose Link.

The Pricing : Adobe Flash Media Streaming Server 4 is offered at US$995. Adobe Flash Media Interactive Server 4 is offered at US$4,500.

Source of this post : Adobe FMS4 Press Release

Packager for iPhone

Special Update from Adobe:
September 9, 2010
Apple’s recent announcement that it has lifted restrictions on its third-party developer guidelines has direct implications for the Packager for iPhone. The feature is available for developers to use today and we will now resume development work on this feature for future releases. This is great news for developers and we’re hearing from our developer community that new AIR applications for iOS devices are already being approved for the Apple App Store. We do want to point out that Apple’s restriction on Flash content running in the browser on iOS devices remains in place.

Read Complete From Here.

Download Packager From Here