-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #45 from velocidi/add-annotation-companion-object
- Loading branch information
Showing
3 changed files
with
67 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,29 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.velocidi.sampleapp"> | ||
package="com.velocidi.sampleapp"> | ||
|
||
<uses-permission android:name="android.permission.INTERNET"/> | ||
<uses-permission android:name="android.permission.INTERNET" /> | ||
|
||
<application | ||
android:name=".SampleApplication" | ||
android:allowBackup="true" | ||
android:icon="@mipmap/ic_launcher" | ||
android:label="@string/app_name" | ||
android:name=".SampleApplication" | ||
android:roundIcon="@mipmap/ic_launcher_round" | ||
android:usesCleartextTraffic="true" | ||
android:supportsRtl="true" | ||
android:theme="@style/AppTheme"> | ||
android:theme="@style/AppTheme" | ||
android:usesCleartextTraffic="true"> | ||
<activity android:name=".JavaActivity"></activity> | ||
<activity | ||
android:name=".MainActivity" | ||
android:label="@string/title_activity_main" | ||
android:theme="@style/AppTheme.NoActionBar"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN"/> | ||
<action android:name="android.intent.action.MAIN" /> | ||
|
||
<category android:name="android.intent.category.LAUNCHER"/> | ||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
</application> | ||
|
||
</manifest> | ||
</manifest> |
55 changes: 55 additions & 0 deletions
55
velocidi-sample/src/main/java/com/velocidi/sampleapp/JavaActivity.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,55 @@ | ||
package com.velocidi.sampleapp; | ||
|
||
import androidx.appcompat.app.AppCompatActivity; | ||
|
||
import android.net.Uri; | ||
import android.os.Bundle; | ||
import android.util.Log; | ||
|
||
import com.velocidi.Channel; | ||
import com.velocidi.Config; | ||
import com.velocidi.Velocidi; | ||
import com.velocidi.UserId; | ||
|
||
import org.json.JSONObject; | ||
|
||
import java.util.Arrays; | ||
|
||
public class JavaActivity extends AppCompatActivity { | ||
private static final String TAG = "MyActivity"; | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
|
||
Channel trackEndpoint = new Channel(Uri.parse("http://tr.cdp.velocidi.com/events"), true); | ||
Channel matchEndpoint = new Channel(Uri.parse("http://match.cdp.velocidi.com/match"), true); | ||
Config config = new Config(trackEndpoint, matchEndpoint); | ||
|
||
Velocidi.init(config, this); | ||
|
||
try { | ||
JSONObject eventJsonObj = new JSONObject(); | ||
eventJsonObj.put("clientId", "velocidi"); | ||
eventJsonObj.put("siteId", "velocidi.com"); | ||
eventJsonObj.put("type", "appView"); | ||
|
||
Velocidi.getInstance().track( | ||
new UserId("user_email_hash", "email_sha256"), | ||
eventJsonObj | ||
); | ||
|
||
} catch (Exception e) { | ||
Log.d(TAG, "Error sending tracking event"); | ||
} | ||
|
||
|
||
Velocidi.getInstance().match( | ||
"someProvider", | ||
Arrays.asList( | ||
new UserId("user_email_hash", "email_sha256"), | ||
new UserId("user_advertising_id", "gaid") | ||
) | ||
); | ||
} | ||
} |
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