Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
# Conflicts:
#	bin/AppsFlyerAIRExtension-witout-gp-support.ane
#	bin/AppsFlyerAIRExtension-witout-gp.ane
#	bin/AppsFlyerAIRExtension.ane
#	bin/AppsFlyerAIRExtension.swc
  • Loading branch information
Vitaly Sokolov committed Mar 11, 2021
2 parents ee54d8b + 51d96a4 commit fb0d2b8
Show file tree
Hide file tree
Showing 22 changed files with 291 additions and 56 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/appsflyer-issue-template.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ e.g. Run `pod install`
## What did you expect to happen?

ℹ Please replace these two lines with what you expected to happen.
e.g. Event to be tracked
e.g. Event to be logged

## What happened instead?

Expand Down
27 changes: 22 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ In order for us to provide optimal support, we would kindly ask you to submit an
- [Plugin info](#plugin-info)
- [Installation](#installation)
- [Notes for Android apps](#android_notes)
- [Notes for iOS apps](#ios_notes)
- [Usage](#Usage)
- [Deep Linking](#dl)
- [IMEI And Android ID Collection (Android Only)](#imei-id)
Expand Down Expand Up @@ -49,8 +50,8 @@ Supported platforms:

Based on:

- iOS AppsFlyerSDK **v6.0.3**
- Android AppsFlyerSDK **v5.4.1**
- iOS AppsFlyerSDK **v6.1.3**
- Android AppsFlyerSDK **v6.1.0**

Built with:

Expand All @@ -70,7 +71,10 @@ If the following was not added automatically please add it to the APP_NAME-app.x
<extensionID>com.appsflyer.adobeair</extensionID>
</extensions>
```
### <a id="android_notes"> **Notes for Android applications:**

### <a id="android_notes"> **Special instructions for Android applications:**
<details>

- On AppsFlyer's dashboard you will need to add "air." prefix to the package name as this is added automatically by Air. For example - an app with the package name "**com.test.android**" , should set the app id on AppsFlyer's Dashboard as "**air.com.test.android**".

- Add the following permissions to Android Manifest (in the app description `APP_NAME-app.xml`):
Expand Down Expand Up @@ -129,6 +133,16 @@ com/appsflyer/internal/a-: '0'
`zipalign -c -v 4 app_name/dist/zipalign_app_name.apk`

9. Your apk `zipalign_app_name.apk` is ready to use!

</details>

### <a id="ios_notes"> **Special instructions for iOS applications:**
<details>
If you use Strict mode ANE, make sure not to call any IDFA related APIs listed below. They are still present in the ActionScript, but will cause an app to crash if invoked.

- `waitForATTUserAuthorization(timeout:int):void;`
</details>

---

## <a id="Usage"> Usage
Expand All @@ -151,18 +165,21 @@ appsFlyer = new AppsFlyerInterface();
appsFlyer.registerConversionListener();
```

Set the Developer key and iOS app ID (optional) and Initialise the SDK:
Set the Developer key and iOS app ID and Initialise the SDK:

```
appsFlyer.appsFlyer.init("DevKey", "iOSAppID");
```

Initialise session reporting (automatically report app launches and background-to-foreground transitions) with DevKey and iOS app ID (optional):
Initialise session reporting (automatically report app launches and background-to-foreground transitions) with DevKey and iOS app ID:

```
appsFlyer.start("DevKey", "iOSAppID");
```

### Note:
If you don't target iOS as a platform, specifying `iOSAppID` ID is not required

---

## <a id="dl"> Deep Linking
Expand Down
Binary file removed SampleApp/libs/AppsFlyerAIRExtension.ane
Binary file not shown.
1 change: 0 additions & 1 deletion SampleApp/src/Main.as
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ public class Main extends Sprite {
addChild(textField);

trace("Main constructor")

appsFlyer.setDebug(true);
appsFlyer.addEventListener(AppsFlyerEvent.INSTALL_CONVERSATION_DATA_LOADED, eventHandler); // GCD success
appsFlyer.addEventListener(AppsFlyerEvent.INSTALL_CONVERSATION_FAILED, eventHandler); // GCD error
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class IsStopped implements FREFunction {
public FREObject call(FREContext freContext, FREObject[] freObjects) {
FREObject result = null;
try {
result = FREObject.newObject(AppsFlyerLib.getInstance().isTrackingStopped());
result = FREObject.newObject(AppsFlyerLib.getInstance().isStopped());
} catch (Exception e) {
e.printStackTrace();
}
Expand Down
10 changes: 5 additions & 5 deletions android/src/com/appsflyer/adobeair/functions/LogEvent.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public FREObject call(FREContext freContext, FREObject[] freObjects) {
Map<String, Object> eventValues = new HashMap<String, Object>();

if (freObjects[0] == null) {
AppsFlyerLib.getInstance().trackEvent(context, eventName, eventValues);
AppsFlyerLib.getInstance().logEvent(context, eventName, eventValues);
return null;
}

Expand All @@ -45,15 +45,15 @@ public FREObject call(FREContext freContext, FREObject[] freObjects) {

if (eventValues.isEmpty()) {
if (eventName == null || eventName.isEmpty()) {
AppsFlyerLib.getInstance().trackEvent(context, null, null);
AppsFlyerLib.getInstance().logEvent(context, null, null);
} else {
AppsFlyerLib.getInstance().trackEvent(context, eventName, null);
AppsFlyerLib.getInstance().logEvent(context, eventName, null);
}
} else {
if (eventName == null || eventName.isEmpty()) {
AppsFlyerLib.getInstance().trackEvent(context, null, null);
AppsFlyerLib.getInstance().logEvent(context, null, null);
} else {
AppsFlyerLib.getInstance().trackEvent(context, eventName, eventValues);
AppsFlyerLib.getInstance().logEvent(context, eventName, eventValues);
}
}
return null;
Expand Down
4 changes: 2 additions & 2 deletions android/src/com/appsflyer/adobeair/functions/Start.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ public FREObject call(FREContext freContext, FREObject[] freObjects) {
}

if(devKey == null) {
AppsFlyerLib.getInstance().startTracking(cnt.getActivity());
AppsFlyerLib.getInstance().start(cnt.getActivity());
} else {
AppsFlyerLib.getInstance().startTracking(cnt.getActivity(), devKey);
AppsFlyerLib.getInstance().start(cnt.getActivity(), devKey);
}

cnt.setDevKey(devKey);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public FREObject call(FREContext freContext, FREObject[] freObjects) {
e.printStackTrace();
}

AppsFlyerLib.getInstance().setCustomerIdAndTrack(id, freContext.getActivity().getApplicationContext());
AppsFlyerLib.getInstance().setCustomerIdAndLogSession(id, freContext.getActivity().getApplicationContext());

return null;
}
Expand Down
6 changes: 3 additions & 3 deletions android/src/com/appsflyer/adobeair/functions/Stop.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ public class Stop implements FREFunction {
public FREObject call(FREContext freContext, FREObject[] freObjects) {

final AppsFlyerContext cnt = (AppsFlyerContext) freContext;
boolean isTrackingStopped = false;
boolean shouldStop = false;
try {
isTrackingStopped = freObjects[0].getAsBool();
shouldStop = freObjects[0].getAsBool();
} catch (Exception e) {
e.printStackTrace();
}
AppsFlyerLib.getInstance().stopTracking(isTrackingStopped, cnt.getActivity().getApplicationContext());
AppsFlyerLib.getInstance().stop(shouldStop, cnt.getActivity().getApplicationContext());

return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public FREObject call(FREContext freContext, FREObject[] freObjects) {
}
}
}
AppsFlyerLib.getInstance().validateAndTrackInAppPurchase(context, publicKey, signature, purchaseData, price, currency, params);
AppsFlyerLib.getInstance().validateAndLogInAppPurchase(context, publicKey, signature, purchaseData, price, currency, params);
} catch (IllegalStateException e) {
e.printStackTrace();
} catch (FRETypeMismatchException e) {
Expand Down
Binary file added bin/AppsFlyerAIRExtension-strict.ane
Binary file not shown.
2 changes: 1 addition & 1 deletion bin/af_apk_fix.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ read -p 'Enter the name of they key from the keystore above that should be used
mkdir tmp;

# Download relecant SDK version for further exctraction of needed files
curl -o ./tmp/android_sdk.zip 'https://repo.maven.apache.org/maven2/com/appsflyer/af-android-sdk/5.4.1/af-android-sdk-5.4.1.aar';
curl -o ./tmp/android_sdk.zip 'https://repo.maven.apache.org/maven2/com/appsflyer/af-android-sdk/6.1.0/af-android-sdk-6.1.0.aar';

# Extract jar from the aar
unzip ./tmp/android_sdk.zip -d tmp/android_sdk;
Expand Down
89 changes: 68 additions & 21 deletions build/build.xml
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="Air Native Extension Build Scripts" default="all">

<!-- Config -->
<property file="build.config"/>

<target name="all" depends="android,ios,swc-default,swc-mobile,package,package_without_gp,package_without_gp_and_support_lib,clear" description="Full build of extension"/>

<target name="all-android-debug" depends="android-debug,ios,swc-mobile,swc-default,package,package_without_gp,package_without_gp_and_support_lib,clear"
description="Full build of extension w/debugging on Android"

<target name="all"
depends="android,ios,swc-default,swc-mobile,package,package_without_gp,package_without_gp_and_support_lib,ios-strict,package-strict,clear"
description="Full build of extension"/>

<target name="all-android-debug"
depends="android-debug,ios,swc-mobile,swc-default,package,package_without_gp,package_without_gp_and_support_lib,ios-strict,package-strict,clear"
description="Full build of extension w/debugging on Android"
/>

<!-- iOS -->
<target name="ios" description="Build iOS Library">
<mkdir dir="../temp/ios/build/"/>

<exec executable="xcodebuild" failonerror="true" dir="../ios/">
<arg line="-project ${name}.xcodeproj"/>
<arg line="-alltargets clean"/>
Expand All @@ -22,7 +25,7 @@
<exec executable="xcodebuild" failonerror="true" dir="../ios/">
<arg line="-project ${name}.xcodeproj"/>
<arg line="-sdk ${ios.sdkversion}"/>
<arg line="-alltargets"/>
<arg line="-target ${name}"/>
<arg line="-configuration Release"/>
<arg line="SYMROOT=../temp/ios/build/"/>
</exec>
Expand All @@ -31,7 +34,7 @@
<copy file="../ios/libAppsFlyerLib.a" todir="../temp/ios" overwrite="true"/>
<delete dir="../temp/ios/build/"/>
</target>

<!-- Android -->
<target name="android-build" description="Build Android Library">
<property name="aapt" location="${android.build.tools.dir}/aapt${exe.ext}" />
Expand Down Expand Up @@ -107,30 +110,30 @@
<property name="ANDROID_DEBUG" value="true"/>
<antcall target="android-build"/>
</target>


<!-- Actionscript mobile -->
<target name="swc-mobile" description="Build SWC library">
<mkdir dir="../temp/swc/content/"/>

<fileset dir="../actionscript/mobile/src" casesensitive="yes" id="classfiles">
<include name="**/*.as"/>
</fileset>

<pathconvert property="classlist" refid="classfiles" pathsep=" " dirsep=".">
<regexpmapper from=".*src.(.*)\.as" to="\1"/>
</pathconvert>

<exec executable="${flex.sdk}/bin/compc${bin.ext}" failonerror="true">
<env key="AIR_SDK_HOME" value="${air.sdk}"/>
<arg line='-source-path ../actionscript/mobile/src'/>
<arg line='-output ../temp/swc/${name}.swc'/>
<arg line='-external-library-path+="${air.sdk}/frameworks/libs/air/airglobal.swc"'/>
<arg line='-include-classes ${classlist}'/>
</exec>

<unzip src="../temp/swc/${name}.swc" dest="../temp/swc/content" overwrite="true"/>

<copy file="../temp/swc/content/library.swf" todir="../temp/ios" overwrite="true"/>
<copy file="../temp/swc/content/library.swf" todir="../temp/android" overwrite="true"/>
</target>
Expand Down Expand Up @@ -215,19 +218,63 @@
<arg value="${name}-witout-gp-support.ane"/>
<arg value="../build/extension.xml"/>
<arg line="-swc swc/${name}.swc"/>

<arg line="-platform iPhone-ARM -platformoptions ../build/platform-ios.xml -C ios/ ."/>
<arg line="-platform Android-ARM -platformoptions ../build/platform-android-without-gp-support.xml -C android/ ."/>
<arg line="-platform Android-ARM64 -platformoptions ../build/platform-android-without-gp-support.xml -C android/ ."/>
<arg line="-platform Android-x86 -platformoptions ../build/platform-android-without-gp-support.xml -C android/ ."/>
<arg line="-platform default -C default/ ."/>
</exec>

<move file="../temp/${name}-witout-gp-support.ane" todir="../bin"/>
</target>


<!-- iOS-Strict-->
<target name="ios-strict" description="Build Strict iOS Library">
<delete dir="../temp/ios/build/"/>
<mkdir dir="../temp/ios/build/"/>

<exec executable="xcodebuild" failonerror="true" dir="../ios/">
<arg line="-project ${name}.xcodeproj"/>
<arg line="-alltargets clean"/>
</exec>

<exec executable="xcodebuild" failonerror="true" dir="../ios/">
<arg line="-project ${name}.xcodeproj"/>
<arg line="-sdk ${ios.sdkversion}"/>
<arg line="-target Strict"/>
<arg line="-configuration Release"/>
<arg line="SYMROOT=../temp/ios/build/"/>
</exec>

<copy file="../temp/ios/build/Release-iphoneos/lib${name}.a" todir="../temp/ios" overwrite="true"/>
<copy file="../ios/libAppsFlyerLib-strict.a" tofile="../temp/ios/libAppsFlyerLib.a" overwrite="true"/>
<delete dir="../temp/ios/build/"/>
</target>

<target name="package-strict" description="Create the extension package without Google play services, support libs
and iOS AdSupport and iAd frameworks">

<exec executable="${air.sdk}/bin/adt${bin.ext}" failonerror="true" dir="../temp">
<arg value="-package"/>
<arg value="-target"/>
<arg value="ane"/>
<arg value="${name}-strict.ane"/>
<arg value="../build/extension.xml"/>
<arg line="-swc swc/${name}.swc"/>

<arg line="-platform iPhone-ARM -platformoptions ../build/platform-ios-strict.xml -C ios/ ."/>
<arg line="-platform Android-ARM -platformoptions ../build/platform-android-without-gp-support.xml -C android/ ."/>
<arg line="-platform Android-ARM64 -platformoptions ../build/platform-android-without-gp-support.xml -C android/ ."/>
<arg line="-platform Android-x86 -platformoptions ../build/platform-android-without-gp-support.xml -C android/ ."/>
<arg line="-platform default -C default/ ."/>
</exec>

<move file="../temp/${name}-strict.ane" todir="../bin"/>
</target>

<target name="clear">
<delete dir="../temp"/>
</target>

</project>
4 changes: 2 additions & 2 deletions build/extension.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<extension xmlns="http://ns.adobe.com/air/extension/33.1">
<id>com.appsflyer.adobeair</id>
<versionNumber>6.0.30</versionNumber>
<versionNumber>6.1.30</versionNumber>
<platforms>
<platform name="Android-ARM">
<applicationDeployment>
Expand Down Expand Up @@ -33,4 +33,4 @@
<applicationDeployment/>
</platform>
</platforms>
</extension>
</extension>
10 changes: 10 additions & 0 deletions build/platform-ios-strict.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<platform xmlns="http://ns.adobe.com/air/extension/33.1">
<sdkVersion>8.1</sdkVersion>
<linkerOptions>
<option>-liconv</option>
<option>-lclang_rt.ios</option>
</linkerOptions>
<packagedDependencies>
<packagedDependency>libAppsFlyerLib.a</packagedDependency>
</packagedDependencies>
</platform>
1 change: 0 additions & 1 deletion build/platform-ios.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
<linkerOptions>
<option>-framework iAd</option>
<option>-framework AdSupport</option>
<!-- <option>-framework AppTrackingTransparency</option>-->
<option>-liconv</option>
<option>-lclang_rt.ios</option>
</linkerOptions>
Expand Down
Loading

0 comments on commit fb0d2b8

Please sign in to comment.