How to use GooglePlayServices libs in Native Extension of Android AIR app?

I am trying to use some features of Google Play Services lib but I could not make it work. I have added the reference to the google play service libs to the manifest file (from Flash Builder)
<application android:enabled="true">
<meta-data  android:name="com.google.android.gms.version"
                android:value="@integer/google_play_services_version" />
<activity android:excludeFromRecents="false">
    <intent-filter>
        <action android:name="android.intent.action.MAIN"/>
            <category android:name="android.intent.category.LAUNCHER"/>
    </intent-filter>
</activity>
</application>
In my ANE, I have added the reference to the source of google-play-services_lib, but when I tried to call the FREFunction to check the availability of Google Play Service
@Override
public FREObject call(FREContext context, FREObject[] args){
     boolean result = false;
     try{
      Activity activitiy = context.getActivity();
      activityContext = activitiy.getBaseContext();
          result = isGooglePlayServiceExists();
     }catch(IllegalStateException e){
      Log.e(AneUtils.TAG, "Failed to get AIR current activity", e);
     FREObject obj = null;
    try{
        obj = FREObject.newObject(result);
    }catch(FREWrongThreadException e){
        Log.e(AneUtils.TAG, "Failed to create FREObject from [" + result + "]");
    return obj;
private boolean isGooglePlayServiceExists(Context activityContext){
    int googlePlayServicesCheck = -1;
    try{
        googlePlayServicesCheck = GooglePlayServicesUtil.isGooglePlayServicesAvailable(activityContext);
    }catch(Exception e){
        Log.e(AneUtils.TAG, "Error getting googlePlayService state",e);
    if(googlePlayServicesCheck == ConnectionResult.SUCCESS){
         return true;
    return false;
The ANE crashed at the line GooglePlayServicesUtil.isGooglePlayServicesAvailable(activityContext) so I really doubted the Google Play Service libs was not added.
Has anyone successfully imported the Google Play Serivce libs into Adobe AIR Android app?
Any advice or help will be appreciated. Thank you.

hey sshk5,
I have managed to make it work. The solution is quite simple, i will explain the steps below
1. Download the latest Android SDK from ADT (including the latest version of GooglePlay lib)
2. Check the version number of Google Play lib ( for example 412312....) something and in your FlashBuilder project, make sure you use the  exact number like
<meta-data  android:name="com.google.android.gms.version" android:value="412312" />
3. Use tool to merge the googlelib jar file with your native extension before importing the native extension to FlashBuilder. If you do not want to use any other tool, you can use the AIR 4.0 which will allow you to use commandline to merge jars (and even dependency resources)
Hope it helps

Similar Messages

  • In App Purchase Native Extension for Android

    Hi All
      I was wondering whether anyone has done any work on an In App Purchase native extension for Android?  If one does not already exist I am going to be starting work on one shortly. 
      I did a google search and found this stackoverflow post http://stackoverflow.com/questions/8053049/air-native-extensions-for-android-in-app-billin g .  The poster is having difficulty with the call back from the Android market.    One of the responses mentions that 'Native extensions have an issue with java libraries' .  Has anyone else come across this issue and if so how did you fix it? 
    thanks for any help you can provide!
    Mark

    I have just finished a (commercial) extension that lets you directly do in-app purchases on android from Actionscript 3. You can check it out here.

  • Developing and using Adobe AIR native extensions for Android devices

    I was using this tutorial:
    "Developing and using Adobe AIR native extensions for Android devices"
    http://www.adobe.com/devnet/air/articles/ane-android-devices.html
    When packing the Flex mobile ANESampleTest to deploy on an Android device, the below error happens
    Error occurred while packaging the application:
    aapt tool failed:invalid resource directory name: /private/var/folders/k8/1thhvkf92h947n_g22hg_v9m0000gn/T/52ba05aa-9001-4d46-9438-db81ef83 06f0/res/drawable-xxhdpi
    invalid resource directory name: /private/var/folders/k8/1thhvkf92h947n_g22hg_v9m0000gn/T/52ba05aa-9001-4d46-9438-db81ef83 06f0/res/values-sw600dp
    invalid resource directory name: /private/var/folders/k8/1thhvkf92h947n_g22hg_v9m0000gn/T/52ba05aa-9001-4d46-9438-db81ef83 06f0/res/values-sw720dp-lan
    Does anyone know what the issue might be?

    Did you find a workaround for the Error? I'm getting the same and I can't seem to find any solution.

  • Problems deploying native extensions on Android

    I'm trying to test a native extension on Android, but I keep getting the following error when trying to build and push to the device:
    "An implentation for native extension 'extension name' required by the application was not found for the target platform."
    I thought I had just messed up when creating my extension somehow so I tried using others and it doesn't matter which extension I try, I always get the same error. Has anyone else ran into this issue? If so, how did you solve it?
    Thanks.

    If anyone else runs into this issue using FlashDevelop, follow the steps here: https://plus.google.com/u/0/109524935899218597554/posts/7rhFEX7S372
    That solved it for me. Woohoo!

  • External library inside Air native extension for android

    Hello everyone,
    First, I've been looking throught this topics
    - http://stackoverflow.com/questions/7732742/air-3-native-extensions-for-android-can-i-how-t o-include-3rd-party-libraries
    - http://stackoverflow.com/questions/24626380/how-to-include-additional-jar-in-android-nativ e-extension-for-adobe-air-mobile
    I got a similar problem. But not exactly the same. And the solution didn't worked for me :(.
    First of all, I don't have any visible error.
    -I can easily talk between java and action script.
    -The gateway is set without problems.
    My problem comes when, from my java-side-part of the extension, I try to call a 3rd party library. This library is (and I think this is where I do something  wrong) linked to my project as an external lib, in .jar format.
    So when I make a call to 3rd party library, it just doesn't print anything. Neither on the adobe part or on the java part. The logs that are before my call are printed but not the ones after.
    I tried different solutions that are:
    -Taking all compiled class files of my external lib and add it inside the main native extension jar [link1]
    same result (no errors)
    -including the 3rd party jar inside the ANE by adding a dependence file that require the .jar [link2]
    with this method i got this error that I don't get
    > aapt tool failed:ERROR: input directory '--auto-add-overlay' does not exist
    My third party library also include's itself some external .jars so do I need to include every jars inside the same packaged jar?
    I can see that a lot of people are dealing with issues like that so my question would be:
    What is the best way to include 3rd party library inside android AIR Native Extension ?.
    For information, here is what I do to create the ANE
    >adt -package -target ane AirInfinitGameANE\AirInfinitGame.ane AirInfinitGameASLib\src\extension.xml -swc AirInfinitGameANE\AirInfinitGameASLib.swc -platform Android-ARM -C AirInfinitGameLib .
    - AirInfinitGameASLib: just the folder with the actionScript part and the config xml file
    - AirInfinitGameANE: folder in the one that will be the native extension
    - AirInfinitGameLib: the eclipse java project. I need to put in that folder the airInfinitgamelib.jar(extension jar) and the library.swf (from the swc file) in order to beeing able to compile the ANE.
    Here it is ! Thanks a lot for thoses who'll read me.

    I had the same problem recently and fixed it as follows;
    - Extract the 3rd party jar file and copy the class folder (usually named "com" in the root of the jar) to my project.
    - Under Project Properties -> Java Build Path -> Libraries click "Add class folder" and add the "com" folder you just extracted from your .jar.
    Hope this helps

  • I'm trying to learn how to use Xcode. I've create a simple Hide App app from a youtube video tut, but I can't get it to export with the icon I've chosen. Any clues why?

    I'm trying to learn how to use Xcode. I've create a simple Hide App app from a youtube video tut, but I can't get it to export with the icon I've chosen. Any clues why?

    We didn't do that video. Why are you asking here?
    Those videos are usually outdated....
    Use the current tools etc., in the iOS Dev Center and iTunes/iTunes U ~ Stanford.

  • ANyone know how to use an Apple keyboard A1359 with a MacBook Air?

    Does anyone know how to use an Apple Keyboard A1359 with a MacBook Air?

    I'm going to ask the hosts to move this to the macbook forum since you're more likely to get answers there than in the iPad one.

  • Strange behavior of Native Extension on Android

    I have a strange behavoir working with a native extension (jar) on my app.
    Lanuncing with debug or run from Flash Builder everything works fine, But when i try to install from the release build i have these errors:
    08-19 17:37:58.311: W/System.err(14317): java.lang.NullPointerException
    08-19 17:37:58.311: W/System.err(14317):     at java.io.File.fixSlashes(File.java:185)
    08-19 17:37:58.311: W/System.err(14317):     at java.io.File.<init>(File.java:134)
    08-19 17:37:58.311: W/System.err(14317):     at com.adobe.air.JavaTrustStoreHelper.getX509TrustManagerFactory(JavaTrustStoreHelper.java:8 1)
    08-19 17:37:58.321: W/System.err(14317):     at com.adobe.air.JavaTrustStoreHelper.getX509TrustManager(JavaTrustStoreHelper.java:110)
    08-19 17:37:58.321: W/System.err(14317):     at com.adobe.air.JavaTrustStoreHelper.enumerateRootCAs(JavaTrustStoreHelper.java:195)
    08-19 17:37:58.331: W/System.err(14317):     at dalvik.system.NativeStart.run(Native Method)
    but only when i invoke a method of my extension the others methods works.
    Thank you

    Yes, all phones are 111, all faxes are 222 and all mobiles are 333
    Please see these images:
    Test-Database in Excel:
    Export from Excel:
    Import into Adress Book:
    The result(s) (see the aligning of "Andere" (=phone), Fax and Mobile):

  • How to debug the jar files while developing the native extension for android

    ANyone???

    I'm having the same problem. I learned FB and Eclipse. I've read the tutorials, created an ane, and built it into a test app. I can debug my test app within FB 4.7 on my mobile device via USB. But there are bugs and they silently fail. Despite all my Log statements in my android java code, they won't output to the FB console. I'm blind, without even trace statements to help fix my ane. I've searched the internet and can't find anything. It must either be terribly obvious or arcane, because no one mentions it.
    Can anyone tell me how to get trace out of an ane?
    The Android reference claims debug and verbose priority are stripped out at runtime. I switched to Log.i() but still get nothing. I suppose for now I'll try throwing errors and see if I can report trace info that way if possible.
    Anyone perhaps have a JUnit test that will mimic AIR using the ane jar file as an extension? Perhaps it will be easier to go full native until the android side is debugged.
    Update Edit: Ok, now spending more time reading the Android developers website. I've found I can use logcat to get all kinds of useful system logs, including the log output of my embedded ane. I created a nice big command line window (180 char wide with a 500 deep buffer so I can scroll back through all the messages), then from the android platform tools directory I ran 'adb shell', then at the shell prompt $>logcat
    Links to info that helped me:
    http://developer.android.com/tools/debugging/index.html
    http://developer.android.com/tools/help/logcat.html

  • How to use shared variables with native c programs

    Hello
    What is the way to use shared variables with native c programs?
    I have a c/c++ program that uses the NIDAQmx C-API to perform measurements. Now I want to communicate to a LabVIEW program via shared variables.
    Is there a C-API for shared variables as there is for the NIDAQmx functionality? Where can I find further documentation? The document "Using the LabVIEW Shared Variable" mentions that one "can read and write to shared variables in ANSI C", but there are no hints about how and where to look.
    Thanks in Advance

    Hi user42,
    with CVI 8.0, you cannot create or configure shared variables. However, you can read or write to an already configured LabVIEW 8.x shared variable from CVI using the DataSocket API.
    In order to do this you need to have and DataSocket 4.3 or higher installed.
    Here's a forum post about using the DataSocket functions a LabVIEW Shared Variables:
    http://forums.ni.com/ni/board/message?board.id=180&message.id=24569&requireLogin=False
    With CVI 8.1 and Measurement Studio 8.1 it's possible to use Shared Variables via the Network Varaiable Library (check out the end of the "Network-Published Shared Variable" section within the "Using the LabVIEW Shared Variable" documentation and the following link).
    Datasocket with LabWindows/CVI and LabVIEW Real-Time:
    http://digital.ni.com/public.nsf/allkb/CC4343488413A2F586256E6200099638?OpenDocument
    Daniel
    NIG

  • How to use the Bluetooth module natively in Parallels Desktop

    link to the instructions on how to enable bluetooth natively in parallels:
    http://www.mattiouz.com/blog/2007/04/13/how-to-use-the-built-in-mac-bluetooth-in -windows-under-parallels/
    link to the .exe that installs the apple driver for the bluetooth module needed in parallels: http://www.mattiouz.com/download/AppleBluetoothInstaller.exe
    now my bluetooth is accessible under parallels 3.0.5158. i scanned with a bluetooth netowrk scanner and i had no problems connecting to my treo 650.
    i took my some time to find the info but @ last i found it;-)
    Message was edited by: smokeonit

    Hi,
    You canr use text modules in script. You have to use standard texts .
    Standard text are maintained in SO10 transaction.
    you can create translation text for other languages also . So based on logon language it will print translation text.
    go to SO10
    give textname it say Ztextname  id as ST and language as EN
    say create, then you will get editor there maintain your text and save it . then come back . Now change language (say for german DE) say create and eneter translation text and save it.
    so now you have created a text called ztextname which you can use in your script.
    Inorder to insert the texts in your script do as below
    go to any window editor and   select path
    Insert->texts->symbols->standard symbols
    then you will get popup  in which you have to mention all the parameters that you have created earlier.
    after inserting just change language EN to sy-langu
    Reward points if useful
    About text elements Sravan already given some informatiomn
    Regards,
    Nageswar

  • Using an ANE (Adobe Native Extension) in a CS Extension

    Hi,
    I've made a simple ANE which works with AIR on a Windows Desktop.
    I'd like to use it within a CS Extension, but it does not work (ExtensionContext.createExtensionContext(...) fails.
    Did anybody succeed doing this ?
    Any idea welcome,
    TIA,
    J.

    Hi,
    Thanks for your answer.
    We have a dll which does quite complex things.
    The idea is to create to ANE to use it either from a AIR desktop application (in Windows and later on MacOS), or from a CS extension within InDesign.
    The desktop application/CS extension are mainly GUI, doing it in Flex would have allowed easy and reusable development for both Windows/MacOS.
    J.

  • HOW TO: using custom fonts in native storyboard views from an ANE on iOS

    Hey,
      In our apps, we have embedded storyboards into an ANE, and successfully used those screens in an AIR app, and figured out how to use custom fonts in those views.
      I wrote a quick blog post about it and just thought I'd share it real quick in case it helps someone.
    ANE for iOS with Custom Framework – Using Custom Fonts | khef.co

    Hi WayHsieh,
    >>can I just "install" fonts through Word App? Does Word Apps have enough privilege to install fonts on Windows? Can I just click a button in Word App, and then it will install fonts automatically?<<
    Based on my understanding, it is hard to achieve the goal. Because the app webpage is hosted inside an Internet Explorer control which, in turn, is hosted inside an app runtime process that provides security and performance isolation and it is under
    low-Integrity level.
    Here is the figure for apps for Office runtime environment in Windows-based desktop and tablet clients:
    You can get more detail about Privacy and security from links below:
    Privacy and security for apps for Office
    Hope it is helpful.
    Regards & Fei
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How to use an external hard drive on a MacBook Air?

    Hi there.
    Recently I bought a portable USB external hard drive for my MacBook Air due to my full startup disk. I also bought multiple disks for the hard drive. I inserted the disk, hooked up the USB, and did everything properly. When I first hooked it up, I lost all internet files that I had saved. All images, videos and downloads (such as Minecraft and other gaming downloads) from the internet were gone and unable to find.
    Now, I don't want to make the wrong move and lose all of my internet files again, so I am asking how to transfer files SAFELY to the USB without any files being deleted. I tranfered files before, but they were just short cuts to the original file, so I am also asking how to fix that as well. My Dad was a computer technician, although he didn't work for Apple, so he doesn't know how to use the USB.
    I've tried everything to find my internet files, but nothing. If there is a way to get them back, I'd be glad if you shared that with me. My dock files aren't working due to this insanely full startup disk, so I'd appreciate it if you could tell me ASAP how to use the USB, how to SAFELY transfer files without them turning into shortcuts, and how to get my internet files back.
    Thank you very much.
    P.s My OS X version is 10.8.3 (Not with Mountain Lion)

    You cannot format a drive so that files will be automatically put on that drive when you run out of room on another drive. Transferring the files must be done specifically by you. You will need to learn how to manage free space on the SSD because 64 GBs is a bit small for much more than OS X.
    Drive Partition and Format
    1. Open Disk Utility in your Utilities folder.
    2. After DU loads select your hard drive (this is the entry with the mfgr.'s ID and size) from the left side list. Click on the Partition tab in the DU main window.
    3. Under the Volume Scheme heading set the number of partitions from the drop down menu to one. Click on the Options button, set the partition scheme to GUID then click on the OK button. Set the format type to Mac OS Extended (Journaled.) Click on the Partition button and wait until the process has completed.
    4. Select the volume you just created (this is the sub-entry under the drive entry) from the left side list. Click on the Erase tab in the DU main window.
    5. Set the format type to Mac OS Extended (Journaled.) Click on the Security button, check the button for Zero Data and click on OK to return to the Erase window.
    6. Click on the Erase button. The format process can take up to several hours depending upon the drive size.

  • Need help with C++ native extension for Android

    Hello!
    I'm trying to build and launch sample native extension written with C++ on Android device.
    But thre
    I have:
    1) Code of native library:
    #include "FlashRuntimeExtensions.h"
    #include <stdint.h>
    #include <stdlib.h>
    #include <string.h>
    FREObject nativeFunction(FREContext ctx, void* funcData, uint32_t argc, FREObject argv[])
              uint32_t length = 12;
              const uint8_t* value = (const uint8_t*)"Hello from C";
              FREObject retObject;
              int res = FRENewObjectFromUTF8(length, value, &retObject);
              if (res == FRE_OK) {
                        return retObject;
              } else {
                        return NULL;
    void ContextInitializer(void *extData, const uint8_t *ctxType, FREContext ctx,
                            uint32_t *numFunctionsToSet,
                            const FRENamedFunction **functionsToSet)
              FRENamedFunction* func = (FRENamedFunction*)malloc(sizeof(FRENamedFunction)*1);
              func[0].name = (const uint8_t*)"nativeFunction";
              func[0].functionData = NULL;
              func[0].function = &nativeFunction;
              *functionsToSet = func;
    void ContextFinalizer(FREContext ctx)
              return;
    void NativeCppExtensionInitializer(void** extDataToSet, FREContextInitializer* ctxInitializerToSet,
                                       FREContextFinalizer* ctxFinalizerToSet)
      extDataToSet = NULL;
      *ctxInitializerToSet = ContextInitializer;
      *ctxFinalizerToSet = ContextFinalizer;
    void NativeCppExtensionFinalizer(void* extData)
       return;
    2) ActionScript Library with Extension class:
    package com.adobe.hellojni
        import flash.external.ExtensionContext;
        public class HelloJniExtension
            private static var context:ExtensionContext;
            public static function init():void {
                if (!context) {
                    context = ExtensionContext.createExtensionContext("com.adobe.canewithjava", null);
            public static function stringFromJNI():String {
                if (context) {
                    return context.call("stringFromJNI") as String;
                return null;

    I do not have time to finish this topic.
    The full problem described in http://forums.adobe.com/thread/1217167

Maybe you are looking for

  • Memory on GNB MAX

    Hi there, i have a queestion about memory type for the GNB MAX, in the specifications it says that the type of memory should be 2100 (266), but can i use another newer? for example one memory at 2700? i know that maybe the performance is not the same

  • Error while runnin oaf page from local machine using jdeveloper

    this is the error stack... Error Page Exception Details. oracle.apps.fnd.framework.OAException: Application: FND, Message Name: SYSTEM-ERROR. Tokens: MESSAGE = Io exception: Connection refused(DESCRIPTION=(TMP=)(VSNNUM=153093632)(ERR=12505)(ERROR_STA

  • Pxi ethernet streaming

    hi i want to know if anyone has experimented with streaming using ethernet on a PXI(e) platform? i want to stream from a 100 Msps PXI digitizer to a non-pxi PC? what are the issues at hand...? currently my system is windows XP, ethernet gigabit on a

  • SAP standard datasource for IDEX stream in SAP BI

    HI       We are implementing SAP ISU retail project.Is there any Sap Standard datasource or Data Extractor for IDEX ? THanks DLK

  • I followed all the steps but my still don´t recognize my iphone

    I followed all the steps but my still don´t recognize my iphone the steps that you have in your web but doen´t work what can i do thanks