├── .gitignore ├── LICENSE ├── README.textile ├── actionscript └── src │ └── com │ └── sticksports │ └── nativeExtensions │ └── canOpenUrl │ └── CanOpenUrl.as ├── android ├── AndroidManifest.xml └── src │ └── com │ └── sticksports │ └── nativeExtensions │ └── canOpenUrl │ ├── CanOpenUrlExtension.java │ ├── CanOpenUrlExtensionCanOpenUrl.java │ └── CanOpenUrlExtensionContext.java ├── bin ├── CanOpenUrl.ane └── CanOpenUrl.swc ├── build ├── air.p12 ├── build.config ├── build.sh ├── build.xml ├── default.properties ├── example.build.config ├── extension.xml └── platform.xml ├── default └── src │ └── com │ └── sticksports │ └── nativeExtensions │ └── canOpenUrl │ └── CanOpenUrl.as ├── ios └── CanOpenUrlIosExtension │ ├── CanOpenUrlIosExtension.xcodeproj │ ├── project.pbxproj │ └── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ └── CanOpenUrlIosExtension.xccheckout │ └── CanOpenUrlIosExtension │ ├── CanOpenUrlIosExtension-Prefix.pch │ └── CanOpenUrlIosExtension.m └── test ├── build ├── CanOpenUrlExtensionTest-app.xml ├── Default.png ├── build.config ├── build.xml ├── example.build.config └── icons │ ├── icon_29.png │ └── icon_57.png └── src └── CanOpenUrlExtensionTest.as /.gitignore: -------------------------------------------------------------------------------- 1 | # General 2 | temp/* 3 | test/bin/* 4 | test/build/build.config 5 | test/build/android.p12 6 | test/build/ios.p12 7 | test/build/ios.mobileprovision 8 | 9 | # Not licensed for distribution 10 | FlashRuntimeExtensions.h 11 | FlashRuntimeExtensions.jar 12 | 13 | # Eclipse FDT 14 | .settings/* 15 | .project 16 | 17 | # Eclipse JDT 18 | android/bin 19 | android/gen 20 | android/res 21 | .classpath 22 | proguard-project.txt 23 | project.properties 24 | 25 | # Xcode 26 | xcuserdata 27 | 28 | # OS X 29 | Icon 30 | Thumbs.db 31 | .DS_Store 32 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | 2 | Air Native Extension for iOS & Android - Can Open URL 3 | ..................................................... 4 | Last Modified: 5 | Author: GnanaPrakash 6 | Comments: To support iOS 64 bit 7 | Date: 26-Jan-2015 8 | 9 | Original: 10 | Author: Richard Lord 11 | Owner: Stick Sports Ltd. 12 | http://www.sticksports.com 13 | 14 | Copyright (c) 2012, Stick Sports Ltd. 15 | All rights reserved. 16 | 17 | Redistribution and use in source and binary forms, with or without modification, 18 | are permitted provided that the following conditions are met: 19 | 20 | - Redistributions of source code must retain the above copyright notice, this 21 | list of conditions and the following disclaimer. 22 | - Redistributions in binary form must reproduce the above copyright notice, this 23 | list of conditions and the following disclaimer in the documentation and/or 24 | other materials provided with the distribution. 25 | - Neither the name of Stick Sports Ltd. nor the names of its contributors may be 26 | used to endorse or promote products derived from this software without specific 27 | prior written permission. 28 | 29 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 30 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 31 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 32 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 33 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 34 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 35 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 36 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 37 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 38 | POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /README.textile: -------------------------------------------------------------------------------- 1 | h1. Air Native Extension for iOS and Android - Can Open URL 2 | 3 | Note: This is a modified version of https://github.com/StickSports/ANE-Can-Open-URL to support iOS 64 bit 4 | 5 | h3. Version 6 | 7 | This is version 1.0 of this extension. 8 | 9 | h3. Binary files 10 | 11 | The bin folder contains the compiled extension and the default swc, which can be used for local testing if required by your development environment (Flash Builder shouldn't need it, but other IDEs may). 12 | 13 | h3. Building 14 | 15 | Requirements - Adobe Air SDK 3.1 or later, XCode IDE, Android SDK 2.2 or later, Java SDK, Apache Ant 16 | 17 | * Run the bash shell script build.sh, this set the JAVA_HOME and invoke the build.xml to creates the native extension and default swc file inside the bin folder. 18 | 19 | terminal>cd build 20 | terminal>./build.sh 21 | 22 | h3. The test project 23 | 24 | A simple test project is included for testing the extension. To build this air project 25 | 26 | * Run the ant build script test/build.xml. This creates the test ipa and apk apps inside the test/bin folder. 27 | 28 | h3. Using the extension 29 | 30 | h4. To find whether an app exists to open a specific URL - 31 | 32 | @CanOpenUrl.canOpen( url : String ) : Boolean@ 33 | 34 | h3. Example code 35 | 36 | You can see the feature in action in the source code of the test project. 37 | 38 | h3. Developers 39 | 40 | * "GnanaPrakash":http://www.knobay.com/ 41 | 42 | -------------------------------------------------------------------------------- /actionscript/src/com/sticksports/nativeExtensions/canOpenUrl/CanOpenUrl.as: -------------------------------------------------------------------------------- 1 | package com.sticksports.nativeExtensions.canOpenUrl 2 | { 3 | import flash.external.ExtensionContext; 4 | 5 | public class CanOpenUrl 6 | { 7 | private static var extensionContext : ExtensionContext; 8 | 9 | /** 10 | * Find if a url scheme exists to open the specified url 11 | */ 12 | public static function canOpen( url : String ) : Boolean 13 | { 14 | if ( !extensionContext ) 15 | { 16 | extensionContext = ExtensionContext.createExtensionContext( "com.sticksports.nativeExtensions.CanOpenUrl", null ); 17 | } 18 | if( !url ) 19 | { 20 | return false; 21 | } 22 | return extensionContext.call( "canOpenUrl", url ) as Boolean; 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /android/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /android/src/com/sticksports/nativeExtensions/canOpenUrl/CanOpenUrlExtension.java: -------------------------------------------------------------------------------- 1 | package com.sticksports.nativeExtensions.canOpenUrl; 2 | 3 | import com.adobe.fre.FREContext; 4 | import com.adobe.fre.FREExtension; 5 | 6 | public class CanOpenUrlExtension implements FREExtension 7 | { 8 | @Override 9 | public FREContext createContext( String contextType ) 10 | { 11 | return new CanOpenUrlExtensionContext(); 12 | } 13 | 14 | @Override 15 | public void dispose() 16 | { 17 | } 18 | 19 | @Override 20 | public void initialize() 21 | { 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /android/src/com/sticksports/nativeExtensions/canOpenUrl/CanOpenUrlExtensionCanOpenUrl.java: -------------------------------------------------------------------------------- 1 | package com.sticksports.nativeExtensions.canOpenUrl; 2 | 3 | import java.util.List; 4 | 5 | import android.content.Intent; 6 | import android.content.pm.PackageManager; 7 | import android.content.pm.ResolveInfo; 8 | import android.net.Uri; 9 | import android.util.Log; 10 | 11 | import com.adobe.fre.FREContext; 12 | import com.adobe.fre.FREFunction; 13 | import com.adobe.fre.FREObject; 14 | 15 | public class CanOpenUrlExtensionCanOpenUrl implements FREFunction 16 | { 17 | 18 | @Override 19 | public FREObject call( FREContext context, FREObject[] args ) 20 | { 21 | try 22 | { 23 | String url = args[0].getAsString(); 24 | final PackageManager packageManager = context.getActivity().getPackageManager(); 25 | final Intent intent = new Intent( Intent.ACTION_VIEW, Uri.parse( url ) ); 26 | List list = packageManager.queryIntentActivities( intent, PackageManager.MATCH_DEFAULT_ONLY ); 27 | Boolean canOpen = list.size() > 0; 28 | return FREObject.newObject( canOpen ); 29 | } 30 | catch ( Exception exception ) 31 | { 32 | Log.w( "CanOpenUrlExtension", exception ); 33 | } 34 | return null; 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /android/src/com/sticksports/nativeExtensions/canOpenUrl/CanOpenUrlExtensionContext.java: -------------------------------------------------------------------------------- 1 | package com.sticksports.nativeExtensions.canOpenUrl; 2 | 3 | import java.util.HashMap; 4 | import java.util.Map; 5 | 6 | import com.adobe.fre.FREContext; 7 | import com.adobe.fre.FREFunction; 8 | 9 | public class CanOpenUrlExtensionContext extends FREContext 10 | { 11 | 12 | @Override 13 | public void dispose() 14 | { 15 | } 16 | 17 | @Override 18 | public Map getFunctions() 19 | { 20 | Map functionMap = new HashMap(); 21 | functionMap.put( "canOpenUrl", new CanOpenUrlExtensionCanOpenUrl() ); 22 | return functionMap; 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /bin/CanOpenUrl.ane: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CollabPlus/ANE-Can-Open-URL/e054652362da78ae954ab14c83e07302172b0047/bin/CanOpenUrl.ane -------------------------------------------------------------------------------- /bin/CanOpenUrl.swc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CollabPlus/ANE-Can-Open-URL/e054652362da78ae954ab14c83e07302172b0047/bin/CanOpenUrl.swc -------------------------------------------------------------------------------- /build/air.p12: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CollabPlus/ANE-Can-Open-URL/e054652362da78ae954ab14c83e07302172b0047/build/air.p12 -------------------------------------------------------------------------------- /build/build.config: -------------------------------------------------------------------------------- 1 | name = CanOpenUrl 2 | 3 | # The location of the flex sdk with Air 3.1 or later 4 | sdk.home = /Applications/Apache Flex/ApacheFlex4.13.0AIR16/ 5 | 6 | # The location of the .p12 certificate file 7 | # This is not your apple developer certificate. It is a certificate for Air, 8 | # which may be a self-signed certificate created with adt 9 | keystore.file = ../build/air.p12 10 | 11 | # The password of the .p12 certificate file 12 | keystore.password = welcome 13 | 14 | # Location of the android sdk 15 | android.sdk = /Users/gp/knobay/workspace/development/softwares/android/adt-bundle-mac-x86_64-20140321/sdk/ -------------------------------------------------------------------------------- /build/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | export JAVA_HOME=`/usr/libexec/java_home -v '1.6*'` 3 | ant $@ -------------------------------------------------------------------------------- /build/build.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | -------------------------------------------------------------------------------- /build/default.properties: -------------------------------------------------------------------------------- 1 | target=android-21 2 | -------------------------------------------------------------------------------- /build/example.build.config: -------------------------------------------------------------------------------- 1 | name = CanOpenUrl 2 | 3 | # The location of the flex sdk with Air 3.1 or later 4 | sdk.home = /path/to/your/flexsdk/folder 5 | 6 | # The location of the .p12 certificate file 7 | # This is not your apple developer certificate. It is a certificate for Air, 8 | # which may be a self-signed certificate created with adt 9 | keystore.file = /path/to/your/certificate/selfSignedTestCert.p12 10 | 11 | # The password of the .p12 certificate file 12 | keystore.password = selfSignedTestPassword 13 | 14 | # Location of the android sdk 15 | android.sdk = path/to/your/android-sdk/platforms/android-8 16 | -------------------------------------------------------------------------------- /build/extension.xml: -------------------------------------------------------------------------------- 1 | 2 | com.sticksports.nativeExtensions.CanOpenUrl 3 | 1.1.0 4 | 5 | 6 | 7 | libCanOpenUrlIosExtension.a 8 | CanOpenUrlExtensionInitializer 9 | CanOpenUrlExtensionFinalizer 10 | 11 | 12 | 13 | 14 | libCanOpenUrlIosExtension.a 15 | CanOpenUrlExtensionInitializer 16 | CanOpenUrlExtensionFinalizer 17 | 18 | 19 | 20 | 21 | CanOpenUrlAndroidExtension.jar 22 | com.sticksports.nativeExtensions.canOpenUrl.CanOpenUrlExtension 23 | com.sticksports.nativeExtensions.canOpenUrl.CanOpenUrlExtension 24 | 25 | 26 | 27 | 28 | CanOpenUrlAndroidExtension.jar 29 | com.sticksports.nativeExtensions.canOpenUrl.CanOpenUrlExtension 30 | com.sticksports.nativeExtensions.canOpenUrl.CanOpenUrlExtension 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /build/platform.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /default/src/com/sticksports/nativeExtensions/canOpenUrl/CanOpenUrl.as: -------------------------------------------------------------------------------- 1 | package com.sticksports.nativeExtensions.canOpenUrl 2 | { 3 | public class CanOpenUrl 4 | { 5 | public static function canOpen( url : String ) : Boolean 6 | { 7 | return false; 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /ios/CanOpenUrlIosExtension/CanOpenUrlIosExtension.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 7996B79A1529823C00D77FC0 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7996B7991529823C00D77FC0 /* Foundation.framework */; }; 11 | 7996B7A01529823C00D77FC0 /* CanOpenUrlIosExtension.m in Sources */ = {isa = PBXBuildFile; fileRef = 7996B79F1529823C00D77FC0 /* CanOpenUrlIosExtension.m */; }; 12 | 7996B7A71529828B00D77FC0 /* FlashRuntimeExtensions.h in Headers */ = {isa = PBXBuildFile; fileRef = 7996B7A61529828B00D77FC0 /* FlashRuntimeExtensions.h */; }; 13 | 7996B7AC1529848800D77FC0 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7996B7AB1529848800D77FC0 /* UIKit.framework */; }; 14 | /* End PBXBuildFile section */ 15 | 16 | /* Begin PBXFileReference section */ 17 | 7996B7961529823C00D77FC0 /* libCanOpenUrlIosExtension.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libCanOpenUrlIosExtension.a; sourceTree = BUILT_PRODUCTS_DIR; }; 18 | 7996B7991529823C00D77FC0 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 19 | 7996B79D1529823C00D77FC0 /* CanOpenUrlIosExtension-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "CanOpenUrlIosExtension-Prefix.pch"; sourceTree = ""; }; 20 | 7996B79F1529823C00D77FC0 /* CanOpenUrlIosExtension.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CanOpenUrlIosExtension.m; sourceTree = ""; }; 21 | 7996B7A61529828B00D77FC0 /* FlashRuntimeExtensions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FlashRuntimeExtensions.h; sourceTree = ""; }; 22 | 7996B7AB1529848800D77FC0 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 23 | /* End PBXFileReference section */ 24 | 25 | /* Begin PBXFrameworksBuildPhase section */ 26 | 7996B7931529823C00D77FC0 /* Frameworks */ = { 27 | isa = PBXFrameworksBuildPhase; 28 | buildActionMask = 2147483647; 29 | files = ( 30 | 7996B7AC1529848800D77FC0 /* UIKit.framework in Frameworks */, 31 | 7996B79A1529823C00D77FC0 /* Foundation.framework in Frameworks */, 32 | ); 33 | runOnlyForDeploymentPostprocessing = 0; 34 | }; 35 | /* End PBXFrameworksBuildPhase section */ 36 | 37 | /* Begin PBXGroup section */ 38 | 7996B78B1529823B00D77FC0 = { 39 | isa = PBXGroup; 40 | children = ( 41 | 7996B7AB1529848800D77FC0 /* UIKit.framework */, 42 | 7996B79B1529823C00D77FC0 /* CanOpenUrlIosExtension */, 43 | 7996B7981529823C00D77FC0 /* Frameworks */, 44 | 7996B7971529823C00D77FC0 /* Products */, 45 | ); 46 | sourceTree = ""; 47 | }; 48 | 7996B7971529823C00D77FC0 /* Products */ = { 49 | isa = PBXGroup; 50 | children = ( 51 | 7996B7961529823C00D77FC0 /* libCanOpenUrlIosExtension.a */, 52 | ); 53 | name = Products; 54 | sourceTree = ""; 55 | }; 56 | 7996B7981529823C00D77FC0 /* Frameworks */ = { 57 | isa = PBXGroup; 58 | children = ( 59 | 7996B7991529823C00D77FC0 /* Foundation.framework */, 60 | ); 61 | name = Frameworks; 62 | sourceTree = ""; 63 | }; 64 | 7996B79B1529823C00D77FC0 /* CanOpenUrlIosExtension */ = { 65 | isa = PBXGroup; 66 | children = ( 67 | 7996B7A61529828B00D77FC0 /* FlashRuntimeExtensions.h */, 68 | 7996B79F1529823C00D77FC0 /* CanOpenUrlIosExtension.m */, 69 | 7996B79C1529823C00D77FC0 /* Supporting Files */, 70 | ); 71 | path = CanOpenUrlIosExtension; 72 | sourceTree = ""; 73 | }; 74 | 7996B79C1529823C00D77FC0 /* Supporting Files */ = { 75 | isa = PBXGroup; 76 | children = ( 77 | 7996B79D1529823C00D77FC0 /* CanOpenUrlIosExtension-Prefix.pch */, 78 | ); 79 | name = "Supporting Files"; 80 | sourceTree = ""; 81 | }; 82 | /* End PBXGroup section */ 83 | 84 | /* Begin PBXHeadersBuildPhase section */ 85 | 7996B7941529823C00D77FC0 /* Headers */ = { 86 | isa = PBXHeadersBuildPhase; 87 | buildActionMask = 2147483647; 88 | files = ( 89 | 7996B7A71529828B00D77FC0 /* FlashRuntimeExtensions.h in Headers */, 90 | ); 91 | runOnlyForDeploymentPostprocessing = 0; 92 | }; 93 | /* End PBXHeadersBuildPhase section */ 94 | 95 | /* Begin PBXNativeTarget section */ 96 | 7996B7951529823C00D77FC0 /* CanOpenUrlIosExtension */ = { 97 | isa = PBXNativeTarget; 98 | buildConfigurationList = 7996B7A31529823C00D77FC0 /* Build configuration list for PBXNativeTarget "CanOpenUrlIosExtension" */; 99 | buildPhases = ( 100 | 7996B7921529823C00D77FC0 /* Sources */, 101 | 7996B7931529823C00D77FC0 /* Frameworks */, 102 | 7996B7941529823C00D77FC0 /* Headers */, 103 | ); 104 | buildRules = ( 105 | ); 106 | dependencies = ( 107 | ); 108 | name = CanOpenUrlIosExtension; 109 | productName = CanOpenUrlIosExtension; 110 | productReference = 7996B7961529823C00D77FC0 /* libCanOpenUrlIosExtension.a */; 111 | productType = "com.apple.product-type.library.static"; 112 | }; 113 | /* End PBXNativeTarget section */ 114 | 115 | /* Begin PBXProject section */ 116 | 7996B78D1529823B00D77FC0 /* Project object */ = { 117 | isa = PBXProject; 118 | attributes = { 119 | LastUpgradeCheck = 0610; 120 | ORGANIZATIONNAME = "Stick Sports Ltd"; 121 | }; 122 | buildConfigurationList = 7996B7901529823B00D77FC0 /* Build configuration list for PBXProject "CanOpenUrlIosExtension" */; 123 | compatibilityVersion = "Xcode 3.2"; 124 | developmentRegion = English; 125 | hasScannedForEncodings = 0; 126 | knownRegions = ( 127 | en, 128 | ); 129 | mainGroup = 7996B78B1529823B00D77FC0; 130 | productRefGroup = 7996B7971529823C00D77FC0 /* Products */; 131 | projectDirPath = ""; 132 | projectRoot = ""; 133 | targets = ( 134 | 7996B7951529823C00D77FC0 /* CanOpenUrlIosExtension */, 135 | ); 136 | }; 137 | /* End PBXProject section */ 138 | 139 | /* Begin PBXSourcesBuildPhase section */ 140 | 7996B7921529823C00D77FC0 /* Sources */ = { 141 | isa = PBXSourcesBuildPhase; 142 | buildActionMask = 2147483647; 143 | files = ( 144 | 7996B7A01529823C00D77FC0 /* CanOpenUrlIosExtension.m in Sources */, 145 | ); 146 | runOnlyForDeploymentPostprocessing = 0; 147 | }; 148 | /* End PBXSourcesBuildPhase section */ 149 | 150 | /* Begin XCBuildConfiguration section */ 151 | 7996B7A11529823C00D77FC0 /* Debug */ = { 152 | isa = XCBuildConfiguration; 153 | buildSettings = { 154 | ALWAYS_SEARCH_USER_PATHS = NO; 155 | ARCHS = "$(ARCHS_STANDARD)"; 156 | CLANG_WARN_BOOL_CONVERSION = YES; 157 | CLANG_WARN_CONSTANT_CONVERSION = YES; 158 | CLANG_WARN_EMPTY_BODY = YES; 159 | CLANG_WARN_ENUM_CONVERSION = YES; 160 | CLANG_WARN_INT_CONVERSION = YES; 161 | CLANG_WARN_UNREACHABLE_CODE = YES; 162 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 163 | COPY_PHASE_STRIP = NO; 164 | ENABLE_STRICT_OBJC_MSGSEND = YES; 165 | GCC_C_LANGUAGE_STANDARD = gnu99; 166 | GCC_DYNAMIC_NO_PIC = NO; 167 | GCC_LINK_WITH_DYNAMIC_LIBRARIES = YES; 168 | GCC_OPTIMIZATION_LEVEL = 0; 169 | GCC_PREPROCESSOR_DEFINITIONS = ( 170 | "DEBUG=1", 171 | "$(inherited)", 172 | ); 173 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 174 | GCC_VERSION = com.apple.compilers.llvm.clang.1_0; 175 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 176 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 177 | GCC_WARN_UNDECLARED_SELECTOR = YES; 178 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 179 | GCC_WARN_UNUSED_FUNCTION = YES; 180 | GCC_WARN_UNUSED_VARIABLE = YES; 181 | IPHONEOS_DEPLOYMENT_TARGET = 6.0; 182 | ONLY_ACTIVE_ARCH = NO; 183 | SDKROOT = iphoneos; 184 | VALID_ARCHS = "arm64 armv7 armv7s i386 x86_64"; 185 | }; 186 | name = Debug; 187 | }; 188 | 7996B7A21529823C00D77FC0 /* Release */ = { 189 | isa = XCBuildConfiguration; 190 | buildSettings = { 191 | ALWAYS_SEARCH_USER_PATHS = NO; 192 | ARCHS = "$(ARCHS_STANDARD)"; 193 | CLANG_WARN_BOOL_CONVERSION = YES; 194 | CLANG_WARN_CONSTANT_CONVERSION = YES; 195 | CLANG_WARN_EMPTY_BODY = YES; 196 | CLANG_WARN_ENUM_CONVERSION = YES; 197 | CLANG_WARN_INT_CONVERSION = YES; 198 | CLANG_WARN_UNREACHABLE_CODE = YES; 199 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 200 | COPY_PHASE_STRIP = YES; 201 | ENABLE_STRICT_OBJC_MSGSEND = YES; 202 | GCC_C_LANGUAGE_STANDARD = gnu99; 203 | GCC_LINK_WITH_DYNAMIC_LIBRARIES = YES; 204 | GCC_VERSION = com.apple.compilers.llvm.clang.1_0; 205 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 206 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 207 | GCC_WARN_UNDECLARED_SELECTOR = YES; 208 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 209 | GCC_WARN_UNUSED_FUNCTION = YES; 210 | GCC_WARN_UNUSED_VARIABLE = YES; 211 | IPHONEOS_DEPLOYMENT_TARGET = 6.0; 212 | ONLY_ACTIVE_ARCH = NO; 213 | SDKROOT = iphoneos; 214 | VALIDATE_PRODUCT = YES; 215 | VALID_ARCHS = "arm64 armv7 armv7s i386 x86_64"; 216 | }; 217 | name = Release; 218 | }; 219 | 7996B7A41529823C00D77FC0 /* Debug */ = { 220 | isa = XCBuildConfiguration; 221 | buildSettings = { 222 | DSTROOT = /tmp/CanOpenUrlIosExtension.dst; 223 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 224 | GCC_PREFIX_HEADER = "CanOpenUrlIosExtension/CanOpenUrlIosExtension-Prefix.pch"; 225 | IPHONEOS_DEPLOYMENT_TARGET = 6.0; 226 | OTHER_LDFLAGS = "-ObjC"; 227 | PRODUCT_NAME = "$(TARGET_NAME)"; 228 | SKIP_INSTALL = YES; 229 | }; 230 | name = Debug; 231 | }; 232 | 7996B7A51529823C00D77FC0 /* Release */ = { 233 | isa = XCBuildConfiguration; 234 | buildSettings = { 235 | DSTROOT = /tmp/CanOpenUrlIosExtension.dst; 236 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 237 | GCC_PREFIX_HEADER = "CanOpenUrlIosExtension/CanOpenUrlIosExtension-Prefix.pch"; 238 | IPHONEOS_DEPLOYMENT_TARGET = 6.0; 239 | OTHER_LDFLAGS = "-ObjC"; 240 | PRODUCT_NAME = "$(TARGET_NAME)"; 241 | SKIP_INSTALL = YES; 242 | }; 243 | name = Release; 244 | }; 245 | /* End XCBuildConfiguration section */ 246 | 247 | /* Begin XCConfigurationList section */ 248 | 7996B7901529823B00D77FC0 /* Build configuration list for PBXProject "CanOpenUrlIosExtension" */ = { 249 | isa = XCConfigurationList; 250 | buildConfigurations = ( 251 | 7996B7A11529823C00D77FC0 /* Debug */, 252 | 7996B7A21529823C00D77FC0 /* Release */, 253 | ); 254 | defaultConfigurationIsVisible = 0; 255 | defaultConfigurationName = Release; 256 | }; 257 | 7996B7A31529823C00D77FC0 /* Build configuration list for PBXNativeTarget "CanOpenUrlIosExtension" */ = { 258 | isa = XCConfigurationList; 259 | buildConfigurations = ( 260 | 7996B7A41529823C00D77FC0 /* Debug */, 261 | 7996B7A51529823C00D77FC0 /* Release */, 262 | ); 263 | defaultConfigurationIsVisible = 0; 264 | defaultConfigurationName = Release; 265 | }; 266 | /* End XCConfigurationList section */ 267 | }; 268 | rootObject = 7996B78D1529823B00D77FC0 /* Project object */; 269 | } 270 | -------------------------------------------------------------------------------- /ios/CanOpenUrlIosExtension/CanOpenUrlIosExtension.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ios/CanOpenUrlIosExtension/CanOpenUrlIosExtension.xcodeproj/project.xcworkspace/xcshareddata/CanOpenUrlIosExtension.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectFavoriteDictionaryKey 6 | 7 | IDESourceControlProjectIdentifier 8 | A3222747-A528-4E0C-9A10-B000714665D6 9 | IDESourceControlProjectName 10 | CanOpenUrlIosExtension 11 | IDESourceControlProjectOriginsDictionary 12 | 13 | 89E7568B3F95E0B267D696DF3400292E0275B51E 14 | https://github.com/CollabPlus/ANE-Can-Open-URL.git 15 | 16 | IDESourceControlProjectPath 17 | ios/CanOpenUrlIosExtension/CanOpenUrlIosExtension.xcodeproj 18 | IDESourceControlProjectRelativeInstallPathDictionary 19 | 20 | 89E7568B3F95E0B267D696DF3400292E0275B51E 21 | ../../../.. 22 | 23 | IDESourceControlProjectURL 24 | https://github.com/CollabPlus/ANE-Can-Open-URL.git 25 | IDESourceControlProjectVersion 26 | 111 27 | IDESourceControlProjectWCCIdentifier 28 | 89E7568B3F95E0B267D696DF3400292E0275B51E 29 | IDESourceControlProjectWCConfigurations 30 | 31 | 32 | IDESourceControlRepositoryExtensionIdentifierKey 33 | public.vcs.git 34 | IDESourceControlWCCIdentifierKey 35 | 89E7568B3F95E0B267D696DF3400292E0275B51E 36 | IDESourceControlWCCName 37 | ANE-Can-Open-URL-master 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /ios/CanOpenUrlIosExtension/CanOpenUrlIosExtension/CanOpenUrlIosExtension-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'CanOpenUrlIosExtension' target in the 'CanOpenUrlIosExtension' project 3 | // 4 | 5 | #ifdef __OBJC__ 6 | #import 7 | #endif 8 | -------------------------------------------------------------------------------- /ios/CanOpenUrlIosExtension/CanOpenUrlIosExtension/CanOpenUrlIosExtension.m: -------------------------------------------------------------------------------- 1 | // 2 | // CanOpenUrlIosExtension.m 3 | // CanOpenUrlIosExtension 4 | // 5 | // Created by Richard Lord on 02/04/2012. 6 | // Copyright (c) 2012 Stick Sports Ltd. All rights reserved. 7 | // 8 | 9 | #import "FlashRuntimeExtensions.h" 10 | #import 11 | 12 | #define DEFINE_ANE_FUNCTION(fn) FREObject (fn)(FREContext context, void* functionData, uint32_t argc, FREObject argv[]) 13 | 14 | DEFINE_ANE_FUNCTION( canOpenUrl ) 15 | { 16 | uint32_t length = 0; 17 | const uint8_t* urlParam = NULL; 18 | 19 | if( FREGetObjectAsUTF8( argv[0], &length, &urlParam ) != FRE_OK ) return NULL; 20 | NSString* url = [NSString stringWithUTF8String: (char*) urlParam]; 21 | 22 | Boolean canOpen = [[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:url]]; 23 | 24 | FREObject result; 25 | if( FRENewObjectFromBool( canOpen, &result ) == FRE_OK ) 26 | { 27 | return result; 28 | } 29 | return NULL; 30 | } 31 | 32 | void CanOpenUrlContextInitializer( void* extData, const uint8_t* ctxType, FREContext ctx, uint32_t* numFunctionsToSet, const FRENamedFunction** functionsToSet ) 33 | { 34 | *numFunctionsToSet = 1; 35 | 36 | FRENamedFunction* func = (FRENamedFunction*) malloc( sizeof(FRENamedFunction) ); 37 | 38 | func[0].name = (const uint8_t*) "canOpenUrl"; 39 | func[0].functionData = NULL; 40 | func[0].function = &canOpenUrl; 41 | 42 | *functionsToSet = func; 43 | } 44 | 45 | void CanOpenUrlContextFinalizer( FREContext ctx ) 46 | { 47 | return; 48 | } 49 | 50 | void CanOpenUrlExtensionInitializer( void** extDataToSet, FREContextInitializer* ctxInitializerToSet, FREContextFinalizer* ctxFinalizerToSet ) 51 | { 52 | extDataToSet = NULL; // This example does not use any extension data. 53 | *ctxInitializerToSet = &CanOpenUrlContextInitializer; 54 | *ctxFinalizerToSet = &CanOpenUrlContextFinalizer; 55 | } 56 | 57 | void CanOpenUrlExtensionFinalizer() 58 | { 59 | return; 60 | } -------------------------------------------------------------------------------- /test/build/CanOpenUrlExtensionTest-app.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | com.knobay.CanOpenUrlExtensionTest 4 | CanOpenUrlExtensionTest 5 | Dummy1 6 | 1.0.0 7 | v1.0.0 8 | 9 | CanOpenUrlExtensionTest.swf 10 | true 11 | portrait 12 | true 13 | true 14 | cpu 15 | none 16 | 17 | 18 | 19 | icons/icon_29.png 20 | icons/icon_57.png 21 | 22 | 23 | 24 | com.sticksports.nativeExtensions.CanOpenUrl 25 | 26 | 27 | 28 | 29 | UIDeviceFamily 31 | 32 | 1 33 | 2 34 | 35 | ]]> 36 | 37 | high 38 | 39 | 40 | 41 | 42 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | ]]> 55 | 56 | 57 | -------------------------------------------------------------------------------- /test/build/Default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CollabPlus/ANE-Can-Open-URL/e054652362da78ae954ab14c83e07302172b0047/test/build/Default.png -------------------------------------------------------------------------------- /test/build/build.config: -------------------------------------------------------------------------------- 1 | # The location of the flex sdk with Air 3.1 or later 2 | sdk.home = /Applications/Apache Flex/4.12.0/ 3 | 4 | # The location of the .p12 developer certificate file 5 | ios.keystore.file = ../build/ios.p12 6 | 7 | # The password of the .p12 developer certificate file 8 | ios.keystore.password = Knobay20!# 9 | 10 | # Provisioning profile 11 | ios.provisioning.profile = ../build/ios.mobileprovision 12 | 13 | # The iOS SDK location 14 | ios.sdk = /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk/ 15 | 16 | # The location of the .p12 developer certificate file 17 | android.keystore.file = ../build/android.p12 18 | 19 | # The password of the .p12 developer certificate file 20 | android.keystore.password = Knobay20!# -------------------------------------------------------------------------------- /test/build/build.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | -------------------------------------------------------------------------------- /test/build/example.build.config: -------------------------------------------------------------------------------- 1 | # The location of the flex sdk with Air 3.1 or later 2 | sdk.home = /path/to/your/flexsdk/folder 3 | 4 | # The location of the .p12 developer certificate file 5 | ios.keystore.file = /path/to/your/ios/certificate.p12 6 | 7 | # The password of the .p12 developer certificate file 8 | ios.keystore.password = password 9 | 10 | # Provisioning profile 11 | ios.provisioning.profile = /path/to/your/ios/ProvisioningProfile.mobileprovision 12 | 13 | # The iOS SDK location 14 | ios.sdk = /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk/ 15 | 16 | # The location of the .p12 developer certificate file 17 | android.keystore.file = /path/to/your/android/certificate.p12 18 | 19 | # The password of the .p12 developer certificate file 20 | android.keystore.password = password -------------------------------------------------------------------------------- /test/build/icons/icon_29.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CollabPlus/ANE-Can-Open-URL/e054652362da78ae954ab14c83e07302172b0047/test/build/icons/icon_29.png -------------------------------------------------------------------------------- /test/build/icons/icon_57.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CollabPlus/ANE-Can-Open-URL/e054652362da78ae954ab14c83e07302172b0047/test/build/icons/icon_57.png -------------------------------------------------------------------------------- /test/src/CanOpenUrlExtensionTest.as: -------------------------------------------------------------------------------- 1 | package 2 | { 3 | import com.sticksports.nativeExtensions.canOpenUrl.CanOpenUrl; 4 | 5 | import flash.display.Shape; 6 | import flash.display.Sprite; 7 | import flash.events.Event; 8 | import flash.events.MouseEvent; 9 | import flash.net.URLRequest; 10 | import flash.net.navigateToURL; 11 | import flash.text.TextField; 12 | import flash.text.TextFormat; 13 | import flash.text.TextFormatAlign; 14 | 15 | 16 | [SWF(width='320', height='480', frameRate='30', backgroundColor='#000000')] 17 | 18 | public class CanOpenUrlExtensionTest extends Sprite 19 | { 20 | private var direction : int = 1; 21 | private var shape : Shape; 22 | private var feedback : TextField; 23 | 24 | private var buttonFormat : TextFormat; 25 | 26 | public function CanOpenUrlExtensionTest() 27 | { 28 | shape = new Shape(); 29 | shape.graphics.beginFill( 0x666666 ); 30 | shape.graphics.drawCircle( 0, 0, 100 ); 31 | shape.graphics.endFill(); 32 | shape.x = 0; 33 | shape.y = 240; 34 | addChild( shape ); 35 | 36 | feedback = new TextField(); 37 | var format : TextFormat = new TextFormat(); 38 | format.font = "_sans"; 39 | format.size = 16; 40 | format.color = 0xFFFFFF; 41 | feedback.defaultTextFormat = format; 42 | feedback.width = 320; 43 | feedback.height = 260; 44 | feedback.x = 10; 45 | feedback.y = 210; 46 | feedback.multiline = true; 47 | feedback.wordWrap = true; 48 | feedback.text = "Hello"; 49 | addChild( feedback ); 50 | 51 | addEventListener( Event.ENTER_FRAME, animate ); 52 | 53 | createButtons(); 54 | } 55 | 56 | private function createButtons() : void 57 | { 58 | var tf : TextField = createButton( "test iTunes" ); 59 | tf.x = 10; 60 | tf.y = 10; 61 | tf.addEventListener( MouseEvent.MOUSE_DOWN, testITunes ); 62 | addChild( tf ); 63 | 64 | tf = createButton( "visit iTunes" ); 65 | tf.x = 170; 66 | tf.y = 10; 67 | tf.addEventListener( MouseEvent.MOUSE_DOWN, visitITunes ); 68 | addChild( tf ); 69 | 70 | tf = createButton( "test twitter" ); 71 | tf.x = 10; 72 | tf.y = 50; 73 | tf.addEventListener( MouseEvent.MOUSE_DOWN, testTwitter ); 74 | addChild( tf ); 75 | 76 | tf = createButton( "visit twitter" ); 77 | tf.x = 170; 78 | tf.y = 50; 79 | tf.addEventListener( MouseEvent.MOUSE_DOWN, visitTwitter ); 80 | addChild( tf ); 81 | 82 | tf = createButton( "test fb" ); 83 | tf.x = 10; 84 | tf.y = 90; 85 | tf.addEventListener( MouseEvent.MOUSE_DOWN, testFacebook ); 86 | addChild( tf ); 87 | 88 | tf = createButton( "visit fb" ); 89 | tf.x = 170; 90 | tf.y = 90; 91 | tf.addEventListener( MouseEvent.MOUSE_DOWN, visitFacebook ); 92 | addChild( tf ); 93 | } 94 | 95 | private function createButton( label : String ) : TextField 96 | { 97 | if( !buttonFormat ) 98 | { 99 | buttonFormat = new TextFormat(); 100 | buttonFormat.font = "_sans"; 101 | buttonFormat.size = 14; 102 | buttonFormat.bold = true; 103 | buttonFormat.color = 0xFFFFFF; 104 | buttonFormat.align = TextFormatAlign.CENTER; 105 | } 106 | 107 | var textField : TextField = new TextField(); 108 | textField.defaultTextFormat = buttonFormat; 109 | textField.width = 140; 110 | textField.height = 30; 111 | textField.text = label; 112 | textField.backgroundColor = 0xCC0000; 113 | textField.background = true; 114 | textField.selectable = false; 115 | textField.multiline = false; 116 | textField.wordWrap = false; 117 | return textField; 118 | } 119 | 120 | private function testITunes( event : MouseEvent ) : void 121 | { 122 | if( CanOpenUrl.canOpen( "itms-apps://itunes.apple.com/app/stick-cricket/id406781620?ls=1&mt=8" ) ) 123 | { 124 | feedback.text = "Can open itms-apps://itunes.apple.com/app/stick-cricket/id406781620?ls=1&mt=8"; 125 | } 126 | else 127 | { 128 | feedback.text = "Cannot open itms-apps://itunes.apple.com/app/stick-cricket/id406781620?ls=1&mt=8"; 129 | } 130 | } 131 | 132 | private function visitITunes( event : MouseEvent ) : void 133 | { 134 | navigateToURL( new URLRequest( "itms-apps://itunes.apple.com/app/stick-cricket/id406781620?ls=1&mt=8" ) ); 135 | feedback.text = "Visiting itms-apps://itunes.apple.com/app/stick-cricket/id406781620?ls=1&mt=8"; 136 | } 137 | 138 | private function testTwitter( event : MouseEvent ) : void 139 | { 140 | if( CanOpenUrl.canOpen( "twitter://user?screen_name=sticksports" ) ) 141 | { 142 | feedback.text = "Can open twitter://user?screen_name=sticksports"; 143 | } 144 | else 145 | { 146 | feedback.text = "Cannot open notwitter://user?screen_name=sticksports"; 147 | } 148 | } 149 | 150 | private function visitTwitter( event : MouseEvent ) : void 151 | { 152 | navigateToURL( new URLRequest( "twitter://user?screen_name=sticksports" ) ); 153 | feedback.text = "Visiting twitter://user?screen_name=sticksports"; 154 | } 155 | 156 | private function testFacebook( event : MouseEvent ) : void 157 | { 158 | if( CanOpenUrl.canOpen( "fb://page/6340028662" ) ) 159 | { 160 | feedback.text = "Can open fb://page/6340028662"; 161 | } 162 | else 163 | { 164 | feedback.text = "Cannot open fb://page/6340028662"; 165 | } 166 | } 167 | 168 | private function visitFacebook( event : MouseEvent ) : void 169 | { 170 | navigateToURL( new URLRequest( "fb://page/6340028662" ) ); 171 | feedback.text = "Visiting fb://page/6340028662"; 172 | } 173 | 174 | private function animate( event : Event ) : void 175 | { 176 | shape.x += direction; 177 | if( shape.x <= 0 ) 178 | { 179 | direction = 1; 180 | } 181 | if( shape.x > 320 ) 182 | { 183 | direction = -1; 184 | } 185 | } 186 | } 187 | } --------------------------------------------------------------------------------