-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
65 changed files
with
2,106 additions
and
309 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.idea | ||
.gradle | ||
*.iml | ||
build | ||
local.properties |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
*.iml | ||
.gradle | ||
/local.properties | ||
/.idea/caches | ||
/.idea/libraries | ||
/.idea/modules.xml | ||
/.idea/workspace.xml | ||
/.idea/navEditor.xml | ||
/.idea/assetWizardSettings.xml | ||
.DS_Store | ||
/build | ||
/captures | ||
.externalNativeBuild |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
apply plugin: 'com.android.application' | ||
apply plugin: 'com.google.gms.google-services' | ||
|
||
android { | ||
compileSdkVersion 29 | ||
buildToolsVersion "29.0.1" | ||
defaultConfig { | ||
applicationId "com.example.tealiumlocationdemoapp" | ||
minSdkVersion 19 | ||
targetSdkVersion 29 | ||
versionCode 1 | ||
versionName "1.0" | ||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" | ||
} | ||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
} | ||
|
||
dependencies { | ||
implementation 'androidx.appcompat:appcompat:1.0.2' | ||
implementation 'androidx.constraintlayout:constraintlayout:1.1.3' | ||
|
||
// Tealium dependencies | ||
implementation 'com.tealium:library:5.7.0' | ||
implementation 'com.tealium:location:1.0.0' | ||
|
||
// Other required dependencies | ||
runtimeOnly 'com.google.android.gms:play-services-location:17.0.0' | ||
implementation 'com.google.firebase:firebase-messaging:20.0.0' | ||
implementation 'com.optimizely.ab:android-sdk:2.1.0' | ||
|
||
// Testing dependencies | ||
testImplementation 'junit:junit:4.12' | ||
androidTestImplementation 'androidx.test:runner:1.2.0' | ||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"_comment": "INSERT YOUR GOOGLE-SERVICES.JSON CONFIGURATION HERE" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Add project specific ProGuard rules here. | ||
# You can control the set of applied configuration files using the | ||
# proguardFiles setting in build.gradle. | ||
# | ||
# For more details, see | ||
# http://developer.android.com/guide/developing/tools/proguard.html | ||
|
||
# If your project uses WebView with JS, uncomment the following | ||
# and specify the fully qualified class name to the JavaScript interface | ||
# class: | ||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview { | ||
# public *; | ||
#} | ||
|
||
# Uncomment this to preserve the line number information for | ||
# debugging stack traces. | ||
#-keepattributes SourceFile,LineNumberTable | ||
|
||
# If you keep the line number information, uncomment this to | ||
# hide the original source file name. | ||
#-renamesourcefileattribute SourceFile | ||
|
||
-keep com.tealium.internal.** { | ||
*; | ||
} |
37 changes: 37 additions & 0 deletions
37
Modules/Location/LocationSample/app/src/main/AndroidManifest.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.example.tealiumlocationdemoapp"> | ||
|
||
<application | ||
android:name=".App" | ||
android:allowBackup="true" | ||
android:icon="@mipmap/ic_launcher" | ||
android:label="@string/app_name" | ||
android:roundIcon="@mipmap/ic_launcher_round" | ||
android:supportsRtl="true" | ||
android:theme="@style/AppTheme" | ||
android:networkSecurityConfig="@xml/network_security_config"> | ||
<service | ||
android:name=".TealiumFirebaseMessagingService" | ||
android:enabled="true" | ||
android:exported="true"> | ||
<intent-filter> | ||
<action android:name="com.google.firebase.MESSAGING_EVENT" /> | ||
</intent-filter> | ||
</service> | ||
|
||
<activity android:name=".MainActivity"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
|
||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
<activity android:name=".LocationTracking" /> | ||
<activity android:name=".LocationConfig" /> | ||
<activity android:name=".LocationAssets" /> | ||
<activity android:name=".LocationUrl" /> | ||
<activity android:name=".LocationGeofencing" /> | ||
</application> | ||
|
||
</manifest> |
22 changes: 22 additions & 0 deletions
22
Modules/Location/LocationSample/app/src/main/Assets/geofences.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
[ | ||
{ | ||
"name": "Tealium_asset1", | ||
"latitude": 59.4610304, | ||
"longitude": -9.9707625, | ||
"radius": 100, | ||
"expire_after": -1, | ||
"trigger_on_enter": true, | ||
"trigger_on_exit": true, | ||
"minimum_dwell_time": 0 | ||
}, | ||
{ | ||
"name": "Tealium_asset2", | ||
"latitude": 39.9061189, | ||
"longitude": -142.2379163, | ||
"radius": 100, | ||
"expire_after": -1, | ||
"trigger_on_enter": true, | ||
"trigger_on_exit": true, | ||
"minimum_dwell_time": 0 | ||
} | ||
] |
11 changes: 11 additions & 0 deletions
11
...les/Location/LocationSample/app/src/main/java/com/example/tealiumlocationdemoapp/App.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package com.example.tealiumlocationdemoapp; | ||
|
||
import android.app.Application; | ||
|
||
public class App extends Application { | ||
@Override | ||
public void onCreate() { | ||
super.onCreate(); | ||
TealiumHelper.initialize(this); | ||
} | ||
} |
102 changes: 102 additions & 0 deletions
102
...n/LocationSample/app/src/main/java/com/example/tealiumlocationdemoapp/LocationAssets.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
package com.example.tealiumlocationdemoapp; | ||
|
||
import android.app.Activity; | ||
import android.os.Bundle; | ||
import android.view.View; | ||
import android.widget.TextView; | ||
import android.widget.Toast; | ||
|
||
import com.tealium.location.TealiumLocation; | ||
|
||
import java.util.ArrayList; | ||
import java.util.HashSet; | ||
import java.util.List; | ||
import java.util.Set; | ||
|
||
public class LocationAssets extends Activity { | ||
|
||
private boolean mLocationShowcaseStarted = false; | ||
private TealiumLocation mInstance; | ||
private final String mGeofenceJsonFile = "geofences.json"; | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_assets); | ||
|
||
findViewById(R.id.location_assets_button_update) | ||
.setOnClickListener(new View.OnClickListener() { | ||
@Override | ||
public void onClick(View v) { | ||
if (mLocationShowcaseStarted) { | ||
drawActiveGeofences(); | ||
drawUsedAssets(); | ||
} else { | ||
showToast("Please press Start first!"); | ||
} | ||
} | ||
}); | ||
|
||
findViewById(R.id.location_assets_button_start) | ||
.setOnClickListener(new View.OnClickListener() { | ||
@Override | ||
public void onClick(View v) { | ||
if (!mLocationShowcaseStarted) { | ||
startLocationShowcase(); | ||
} else { | ||
showToast("Showcase Already Started!"); | ||
} | ||
} | ||
}); | ||
|
||
findViewById(R.id.location_assets_button_stop).setOnClickListener(new View.OnClickListener() { | ||
@Override | ||
public void onClick(View v) { | ||
if (!mLocationShowcaseStarted) { | ||
showToast("Please press Start first!"); | ||
} | ||
} | ||
}); | ||
} | ||
|
||
private void startLocationShowcase() { | ||
mLocationShowcaseStarted = true; | ||
|
||
Set<String> tealiumInstances = new HashSet<>(); | ||
tealiumInstances.add(TealiumHelper.TEALIUM_MAIN); | ||
|
||
mInstance = TealiumLocation.setupInstanceWithFile(this, tealiumInstances, mGeofenceJsonFile); | ||
mInstance.startLocationUpdates(true, 5000); | ||
drawUsedAssets(); | ||
drawActiveGeofences(); | ||
} | ||
|
||
private void drawActiveGeofences() { | ||
List<String> activeGeofences = mInstance.getAllGeofenceNames(); | ||
String geofenceNames = ""; | ||
|
||
for (String name : activeGeofences) { | ||
geofenceNames = geofenceNames + name + "\n"; | ||
} | ||
|
||
TextView geofenceNameData = findViewById(R.id.location_assets_geofencesdata); | ||
geofenceNameData.setText(geofenceNames); | ||
} | ||
|
||
private void drawUsedAssets() { | ||
TextView urlData = findViewById(R.id.location_assets_assetsdata); | ||
urlData.setText(mGeofenceJsonFile); | ||
} | ||
|
||
private void showToast(String message) { | ||
Toast.makeText(getApplicationContext(), message, Toast.LENGTH_LONG).show(); | ||
} | ||
|
||
@Override | ||
public void onDestroy() { | ||
super.onDestroy(); | ||
if (mLocationShowcaseStarted) { | ||
TealiumLocation.destroyInstance(); | ||
} | ||
} | ||
} |
Oops, something went wrong.