working on it ...

Filters

Explore Public Snippets

Sort by

Found 95 snippets matching: ndk

    public by FMXExpress modified Nov 12, 2014  7061  9  9  4

    Install A Shortcut On Android With Delphi XE5 Firemonkey

    http://www.fmxexpress.com/install-shortcuts-on-the-android-home-screen-with-delphi-xe5-firemonkey/
    //Android permission required:
    //<uses-permission android:name=”com.android.launcher.permission.INSTALL_SHORTCUT”/>
        
    Uses
    Androidapi.JNI.GraphicsContentViewText, FMX.Helpers.Android,
    Androidapi.JNI.JavaTypes, FMX.Platform.Android, AndroidApi.JniBridge, AndroidApi.Jni.App,
    AndroidAPI.jni.OS;
    
    {$IFDEF ANDROID}
    var
    ShortcutIntent: JIntent;
    addIntent: JIntent;
    wIconIdentifier : integer;
    wIconResource : JIntent_ShortcutIconResource;
    {$ENDIF}
    begin
    {$IFDEF ANDROID}
    
    ShortcutIntent := TJIntent.JavaClass.init(SharedActivityContext, SharedActivityContext.getClass);
    ShortcutIntent.setAction(TJIntent.JavaClass.ACTION_MAIN);
    
    addIntent := TJIntent.Create;
    addIntent.putExtra(TJIntent.JavaClass.EXTRA_SHORTCUT_INTENT, TJParcelable.Wrap((shortcutIntent as ILocalObject).GetObjectID));// here we need to cast the intent as it’s not done in delphi by default, not like java
    addIntent.putExtra(TJIntent.JavaClass.EXTRA_SHORTCUT_NAME, StringToJString(Application.Title));
    addIntent.setAction(StringToJString(‘com.android.launcher.action.INSTALL_SHORTCUT’));
    // get icon resource identifier
    wIconIdentifier := SharedActivity.getResources.getIdentifier(StringToJString(‘ic_launcher’), StringToJString(‘drawable’), StringToJString(‘com.embarcadero.HeaderFooterApplication’)); // if the app name change, you must change the package name
    wIconResource := TJIntent_ShortcutIconResource.JavaClass.fromContext(SharedActivityContext, wIconIdentifier);
    // set icon for shortcut
    addIntent.putExtra(TJIntent.JavaClass.EXTRA_SHORTCUT_ICON_RESOURCE, TJParcelable.Wrap((wIconResource as ILocalObject).GetObjectID));
    
    SharedActivityContext.sendBroadcast(addIntent);
    
    {$ENDIF}
     

    external by brettdh modified Nov 29, 2014  91  0  1  0

    Script to search paths for importable Android NDK modules and symlink their build files to $NDK_MODULE_PATH.

    Script to search paths for importable Android NDK modules and symlink their build files to $NDK_MODULE_PATH.: setup_ndk_modules.py
    #!/usr/bin/env python
    
    import os, sys, re
    import argparse
    from itertools import combinations
    
    module_re = re.compile("LOCAL_MODULE[^a-z_]+([a-z_]+)")
    build_re = re.compile("BUILD_SHARED_LIBRARY")
    
    def getModules(android_makefile):
        cur_module = None
        modules = []
        
        with open(android_makefile) as f:
            for line in f.readlines():
                module_match = re.search(module_re, line)
                if module_match:
                    cur_module = module_match.group(1)
                    continue
    
                build_match = re.search(build_re, line)
                if build_match:
                    modules.append(cur_module)
                    
        return modules
    
    def main():
        if "NDK_MODULE_PATH" not in os.environ:
            print "Please define NDK_MODULE_PATH first."
            sys.exit(1)
    
        parser = argparse.ArgumentParser(description="Searches a directory tree for NDK modules and " +
                                         "adds symlinks to NDK_MODULE_PATH for them.")
        parser.add_argument("search_dirs", nargs="+", 
                            help="one or more directories to search for NDK modules.")
        parser.add_argument("--namespace", default="edu.umich.mobility", help="Directory where symlinks will be placed.")
    
        args = parser.parse_args()
        for dir_pair in combinations(args.search_dirs, 2):
            if dir_pair[0] in dir_pair[1] or dir_pair[1] in dir_pair[0]:
                print "Error: search dirs mustn't overlap"
                parser.error("%s and %s have a common path element" % dir_pair)
    
        module_dirs = {}
        ndk_module_path = os.environ["NDK_MODULE_PATH"].strip()
        if ":" in ndk_module_path:
            ndk_module_path = ndk_module_path.split(":")[0]
        if not os.path.exists(ndk_module_path):
            os.mkdir(ndk_module_path)
    
        namespace_path = "%s/%s" % (ndk_module_path, args.namespace)
        if not os.path.exists(namespace_path):
            os.mkdir(namespace_path)
                
        for root_dir in args.search_dirs:
            if not os.path.exists(root_dir):
                print "Skipping %s; doesn't exist" % root_dir
                continue
                
            for dirpath, dirs, files in os.walk(root_dir):
                if "Android.mk" in files:
                    mk_path = "%s/Android.mk" % dirpath
                    print "Found %s" % mk_path
                    cur_modules = getModules(mk_path)
                    for module_name in cur_modules:
                        module_dirs[module_name] = dirpath
    
        print "About to symlink modules into %s" % namespace_path
        for entry in module_dirs.items():
            module_name, module_path = entry
            print "  %-10s => %s" % (module_name, module_path)
    
        confirm = raw_input("Proceed? [y/n] ")
        if not confirm.lower().startswith("y"):
            print "Making no symlinks."
            sys.exit(1)
    
        for entry in module_dirs.items():
            module_name, module_path = entry
            link_path = "%s/%s" % (namespace_path, module_name)
            if os.path.exists(link_path):
                print "%s already exists" % link_path
            else:
                print "Symlink: %s => %s" % (link_path, module_path)
                os.symlink(module_path, link_path)
    
    if __name__ == '__main__':
        main()
    
    
    

    external by mnemonicflow modified Jan 5, 2016  868  13  3  0

    Android NDK samples https://github.com/googlesamples/android-ndk

    Android NDK samples https://github.com/googlesamples/android-ndk: android_ndk_samples.md
    # [Android NDK samples](https://github.com/googlesamples/android-ndk)
    
    1. [Hello JNI](https://github.com/googlesamples/android-ndk/tree/master/hello-jni)
    =============
    Hello JNI is an Android sample that uses JNI to call C code from a Android Java Activity.
    
    2. [Hello Third Party](https://github.com/googlesamples/android-ndk/tree/master/hello-thirdparty)
    =============
    Hello Third Party Lib is an Android C++ sample that depends on a prebuilt static library (Play Game C++ SDK).
    
    3. [Hello GL2](https://github.com/googlesamples/android-ndk/tree/master/hello-gl2)
    =============
    Hello GL2 is an Android C++ sample that draws a triangle using GLES 2.0 API.
    
    It uses JNI to do the rendering in C++ over a
    [GLSurfaceView](http://developer.android.com/reference/android/opengl/GLSurfaceView.html)
    
    4. [gles3jni](https://github.com/googlesamples/android-ndk/tree/master/gles3jni)
    =============
    gles3jni is an Android C++ sample that demonstrates how to use OpenGL ES 3.0 from JNI/native code.
    
    The OpenGL ES 3.0 rendering path uses a few new features compared to the
    OpenGL ES 2.0 path:
    - Instanced rendering and vertex attribute divisor to reduce the number of
      draw calls and uniform changes.
    - Vertex array objects to reduce the number of calls required to set up
      vertex attribute state on each frame.
    - Explicit assignment of attribute locations, eliminating the need to query
      assignments.
    
    5. [Teapot](https://github.com/googlesamples/android-ndk/tree/master/Teapot)
    =============
    Teapot is an Android C++ sample that draws a Teapot mesh using GLES 2.0 API and [NativeActivity](http://developer.android.com/reference/android/app/NativeActivity.html).
    
    6. [More Teapots](https://github.com/googlesamples/android-ndk/tree/master/MoreTeapots)
    =============
    More Teapots is an Android C++ sample that draws multiple instances of the same Teapot mesh using GLES 3.0 Instanced Rendering and [NativeActivity](http://developer.android.com/reference/android/app/NativeActivity.html).
      
    7. [San Angeles](https://github.com/googlesamples/android-ndk/tree/master/san-angeles)
    =============
    San Angeles is an Android port of a demo that uses GLES C/API to render a procedural scene.
    See the original [README](https://github.com/googlesamples/android-ndk/blob/master/san-angeles/app/src/main/jni/README.txt) for more details about the original GLES port.
    
    8. [Bitmap Plasma](https://github.com/googlesamples/android-ndk/tree/master/bitmap-plasma)
    =============
    Bitmap Plasma is an Android sample that uses JNI to render a plasma effect in an Android [Bitmap](http://developer.android.com/reference/android/graphics/Bitmap.html) from C code.
    
    9. [Native Plasma](https://github.com/googlesamples/android-ndk/tree/master/native-plasma)
    =============
    Native Plasma is an Android sample that renders a plasma effect in a Bitmap from C code using [Native Activity](http://developer.android.com/reference/android/app/NativeActivity.html).
    
    10. [Native Activity](https://github.com/googlesamples/android-ndk/tree/master/native-activity)
    =============
    Native Activity is an Android sample that initializes a GLES 2.0 context and reads accelerometer data from C code using [Native Activity](http://developer.android.com/reference/android/app/NativeActivity.html).
    
    11. [Endless Tunnel](https://github.com/googlesamples/android-ndk/tree/master/endless-tunnel)
    =============
    Endless Tunnel is a sample game that shows how to:
    - use the Android Studio C++ support
    - implement a game using Android native glue
    - implement joystick support, including robust DPAD navigation for non-touch screens
    
    It is NOT the goal of this sample to show the best way to write the game logic, load resources, etc. The game itself was intentionally kept rudimentary in order to keep the focus on the Android Studio C++ integration. For example, this game contains textures and geometry hard-coded in code, which works for small demo games like this one, but doesn't scale well to real games.
    
    12. [Native Media](https://github.com/googlesamples/android-ndk/tree/master/native-media)
    =============
    Native Media is an Android sample that uses OpenMAX AL to play a video.
    
    13. [Native Codec](https://github.com/googlesamples/android-ndk/tree/master/native-codec)
    =============
    Native Codec is an Android C++ sample that uses the Native Media Codec API to play a video.
    
    14. [Native Audio](https://github.com/googlesamples/android-ndk/tree/master/native-audio)
    =============
    Native Audio is an Android sample that plays and records sounds with the C++ OpenSLES API using JNI.
    
    15. [Audio-Echo](https://github.com/googlesamples/android-ndk/tree/master/audio-echo)
    =============
    The sample demos how to use OpenSL ES to create a player and recorder in Android Fast Audio Path, and connect them to loopback audio. On most android devices, there is a optimized audio path that is tuned up for low latency purpose. The sample creates player/recorder to work in this highly optimized audio path(sometimes called native audio path, [low latency path](http://stackoverflow.com/questions/14842803/low-latency-audio-playback-on-android?rq=1), or fast audio path). The application is validated against the following configurations:
      *   Android L    AndroidOne
      *   Android M    Nexus 5, Nexus 9
    
    16. [Sensor-Graph](https://github.com/googlesamples/android-ndk/tree/master/sensor-graph)
    =============
    Sensor graph is a C++ Android sample that read current accelerometer values and draw them using OpenGL.
    
    It demonstrate usage of the following Native C++ API:
    - [Sensors](http://developer.android.com/ndk/reference/group___sensor.html)
    - [Assets](http://developer.android.com/ndk/reference/group___asset.html)
    
    

    external by kenmasumitsu modified Jul 17, 2015  160  0  2  0

    NDK log utils

    NDK log utils: gistfile1.txt
    #define TAG "TAG"
    #define LOG_VERBOSE(...) __android_log_print(ANDROID_LOG_VERBOSE, TAG, __VA_ARGS__)
    #define LOG_DEBUG(...)   __android_log_print(ANDROID_LOG_DEBUG, TAG, __VA_ARGS__)
    #define LOG_INFO(...)    __android_log_print(ANDROID_LOG_INFO, TAG, __VA_ARGS__)
    #define LOG_WARN(...)    __android_log_print(ANDROID_LOG_WARN, TAG, __VA_ARGS__)
    #define LOG_ERROR(...)   __android_log_print(ANDROID_LOG_ERROR, TAG, __VA_ARGS__)
    #define LOG_FATAL(...)   __android_log_print(ANDROID_LOG_FATAL, TAG, __VA_ARGS__)
    
    

    external by Github modified Mar 4, 2015  148  0  2  0

    NDK location

    NDK location: .ant.properties
    #
    # The Android NDK home directory:
    #
    ndk.home=C\:\\ndk
    
    
    #
    # The list of native AAC decoders.
    # Allowed decoders are: faad2, ffmpeg, opencore-aacdec.
    #
    # NOTE: if you change this property then it is recommended to clean the project
    #       (ant mrproper)
    #
    # Examples:
    #   aac.decoders=opencore-aacdec
    #   aac.decoders=faad2 ffmpeg opencore-aacdec
    #
    aac.decoders=faad2 ffmpeg opencore-aacdec
    
    
    #
    # Enable 4-th decoder - MMS/ASF/WMA
    #   mms=yes
    #
    mms=yes
    
    
    #
    # The debug level of the JNI/C code.
    # Allowed values are: trace, debug, info, warn, error
    #
    jni.loglevel=info
    
    
    #
    # Options passed to the Makefile, e.g:
    #   -d               = debug all
    #   --debug=v        = set debug level (a, b, v, i, j, m)
    #   -qp              = print the database of rules (nothing remade)
    #
    # Or targets:
    #   dump             = dumps all targets
    #
    make.options=
    
    
    

    external by sxyx2008 modified Sep 9, 2014  80  1  1  0

    ndk r9d url

    ndk r9d url: ndk.md
    # NDK r9d url
    
    * linux: [http://dl.google.com/android/ndk/android-ndk-r9-linux-x86.tar.bz2](http://dl.google.com/android/ndk/android-ndk-r9-linux-x86.tar.bz2)
    * windows: [http://dl.google.com/android/ndk/android-ndk-r9d-windows-x86_64.zip](http://dl.google.com/android/ndk/android-ndk-r9d-windows-x86_64.zip)
    * mac os x: [https://dl.google.com/android/ndk/android-ndk-r9d-darwin-x86_64.tar.bz2](https://dl.google.com/android/ndk/android-ndk-r9d-darwin-x86_64.tar.bz2)
    
    

    external by Jan Holman modified Dec 15, 2015  80  0  1  0

    Duplicity v MZK a NDK fedorách

    Duplicity v MZK a NDK fedorách: Kořeny (s počtem objektů)
    1036 null
    7444 uuid:c3318d70-6f69-11e2-b9fa-005056827e52 Čin
    1037 uuid:ec78e650-298d-11e2-9f39-005056827e51 Brno v minulosti a dnes: sborník příspěvků k dějinám a výstavbě Brna
       1 uuid:4eac74b0-e92c-11dc-9fa1-000d606f5dc6 Rudé právo (jen 1? wtf?)
     101 uuid:4e0bb760-7ce2-11e2-b930-005056827e51 Nauka o pěstování révy vinné
      81 uuid:724767d0-9864-11e2-9a9f-005056827e51 Pěstování révy vinné v domácích zahrádkách
      29 uuid:7429cb92-9cb3-11e0-8637-0050569d679d Atlas d'Afrique En 20. Carter
    5805 uuid:8376d290-87e1-11e2-b238-005056827e52 Slovo národa
     630 uuid:98e18620-c828-11e2-b6da-005056827e52 Kniha pro každého rolníka a hospodáře: sbírka vědomostí hospodářských rolníku našemu předůležitých a nevyhnutelně potřebných
     257 uuid:992aeaa0-1cd3-11e2-bec6-005056827e51 Chotěšov a jeho dominanta (btw to nemá obrázky)
    
    
    

    external by Intern modified Feb 25, 2015  68  0  1  0

    Install Android SDK & NDK on Ubuntu

    Install Android SDK & NDK on Ubuntu: install_android_dev.sh
    #!/bin/bash
    
    # Check machine type (32 or 64-bit) & install JDK
    MACHINE_TYPE=`uname -a`
    sudo apt-get install openjdk-7-jdk
    
    # Prepare /opt/Google directory 
    sudo chmod ao+rw /opt
    sudo chown :adm /opt
    mkdir /opt/Google/
    
    # Download Android NDK
    if [[ $MACHINE_TYPE == *"x86_64"* ]]
    then
    wget http://dl.google.com/android/ndk/android-ndk-r10d-linux-x86_64.bin
    else
    wget http://dl.google.com/android/ndk/android-ndk-r10d-linux-x86.bin
    fi
    
    # Install Android NDK
    chmod +x android-ndk*.bin
    ./android-ndk*.bin
    rm -rf eclipse-java*
    mkdir /opt/Google/android-ndks
    rm android-ndk-*.bin
    mv android-ndk-* /opt/Google/android-ndks/
    
    # Download Eclipse
    if [[ $MACHINE_TYPE == *"x86_64"* ]]
    then
    wget http://ftp.snt.utwente.nl/pub/software/eclipse/technology/epp/downloads/release/luna/SR1a/eclipse-java-luna-SR1a-linux-gtk-x86_64.tar.gz
    else
    wget http://ftp.snt.utwente.nl/pub/software/eclipse/technology/epp/downloads/release/luna/SR1a/eclipse-java-luna-SR1a-linux-gtk.tar.gz
    fi
    
    # Install Eclipse
    rm -rf /opt/eclipse
    tar -zxvf eclipse-java-luna-SR1a-linux-gtk*.tar.gz -C /opt/
    rm -rf eclipse-java*
    
    # Install Android SDK and configure SDK & NDK
    echo Add ADT Plugin software site at https://dl-ssl.google.com/android/eclipse/
    echo Select Android Development Tools
    echo Select Android Native Development Tools
    echo When prompted by Android Development (Welcome to Android Development window)
    echo - include Android 2.2 in installation
    echo - at the same time point target directory to /opt/Google/android-sdks/
    echo Add Android API 8 & 10
    echo Point Window -> Preferences -> Android -> NDK -> NDK Location to the right path
    echo Press ENTER to launch Eclipse
    read
    /opt/eclipse/eclipse &
    echo Press ENTER when finished
    read
    
    
    

    external by Andrew Paramoshkin modified Nov 22, 2016  68  0  1  0

    Dockerfile for using in GitLab CI (or similar) to create Android builds. Includes Android SDK 24 and r13b Android NDK

    Dockerfile for using in GitLab CI (or similar) to create Android builds. Includes Android SDK 24 and r13b Android NDK: Dockerfile
    FROM openjdk:8-jdk
    MAINTAINER Andrew Paramoshkin <paramoshkin.andrew@gmail.com>
    
    ENV ANDROID_TARGET_SDK="24" \
        ANDROID_BUILD_TOOLS="24.0.0" \
        ANDROID_SDK_TOOLS="24.4.1" \
        ANDROID_NDK_VERSION="13" \
        PATH="$PWD/android-sdk-linux/tools:$PATH"
    
    RUN apt-get --quiet update --yes
    RUN apt-get --quiet install --yes wget tar unzip lib32stdc++6 lib32z1
    
    RUN wget --quiet --output-document=android-sdk.tgz https://dl.google.com/android/android-sdk_r${ANDROID_SDK_TOOLS}-linux.tgz && \
        tar --extract --gzip --file=android-sdk.tgz
    
    RUN mkdir "/android-sdk-linux/licenses" || true && \
    	echo -e "\n8933bad161af4178b1185d1a37fbf41ea5269c55" > "/android-sdk-linux/licenses/android-sdk-license" && \
    	echo -e "\n84831b9409646a918e30573bab4c9c91346d8abd" > "/android-sdk-linux/licenses/android-sdk-preview-license"
    
    RUN echo y | android --silent update sdk --no-ui --all --filter android-${ANDROID_TARGET_SDK} && \
        echo y | android --silent update sdk --no-ui --all --filter platform-tools && \
        echo y | android --silent update sdk --no-ui --all --filter build-tools-#{ANDROID_BUILD_TOOLS}
    
    RUN echo y | android --silent update sdk --no-ui --all --filter extra-android-m2repository && \
        echo y | android --silent update sdk --no-ui --all --filter extra-google-google_play_services && \
        echo y | android --silent update sdk --no-ui --all --filter extra-google-m2repository
    RUN wget --quiet --output-document=android-ndk.zip https://dl.google.com/android/repository/android-ndk-r${ANDROID_NDK_VERSION}b-linux-x86_64.zip && \
    	unzip android-ndk.zip
    RUN rm android-sdk.tgz && rm android-ndk.zip
    
    ENV "ANDROID_HOME" $PWD/android-sdk-linux
    ENV "ANDROID_NDK_HOME" $PWD/android-ndk-r${ANDROID_NDK_VERSION}b
    
    

    external by Anthony Guevara modified Nov 14, 2016  68  0  1  0

    ndk cross compiler env variables

    ndk cross compiler env variables: ndk_cc_env_variables.txt
    Environment variables to set:
      export NDK="/home/anthony/android-ndk-r13b"
      export TOOLCHAIN="/home/anthony/android-toolchain"
      export export SYSROOT="/home/anthony/android-ndk-r13b/platforms/android-21/arch-arm"
      export CC="/home/anthony/android-ndk-r13b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc-4.9 --sysroot=$SYSROOT"
      
    Programs needed on top of the NDK and SDK:  
      sudo apt-get install android-tools-adb android-tools-fastboot
      
    Building the standalone toolchain:
      $NDK/build/tools/make_standalone_toolchain.py --arch arm --api 21 --install-dir /home/anthony/android-toolchain
    
    
    • Public Snippets
    • Channels Snippets