Skip to content

Commit 8f80a45

Browse files
committed
Methods Changed
1 parent e7ff27b commit 8f80a45

File tree

101 files changed

+3503
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

101 files changed

+3503
-0
lines changed

LICENSE

Lines changed: 674 additions & 0 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
<h1 style="text-align:center;">Sense User Activity - Android</h1>
2+
3+
<p style="text-align:center;width:100%;">
4+
<img width="9%" src="https://custom-icon-badges.demolab.com/github/license/denvercoder1/custom-icon-badges?logo=law"> <img width="12%" src="https://custom-icon-badges.demolab.com/github/last-commit/DenverCoder1/custom-icon-badges?logo=history&logoColor=white"> <img width="9%" src="https://custom-icon-badges.demolab.com/github/actions/workflow/status/DenverCoder1/custom-icon-badges/ci.yml?branch=main&logo=check-circle-fill&logoColor=white">
5+
</p>
6+
7+
<h2 style="text-align:center;">Welcome to Sense's open source repository</h2>
8+
9+
<p style="text-align:center;width:100%;">
10+
<img width="4.5%" src="https://custom-icon-badges.demolab.com/badge/Fork-orange.svg?logo=fork"> <img width="4.5%" src="https://custom-icon-badges.demolab.com/badge/Star-yellow.svg?logo=star"> <img width="6.5%" src="https://custom-icon-badges.demolab.com/badge/Commit-green.svg?logo=git-commit&logoColor=fff">
11+
</p>
12+
13+
<p style="text-align:center;">
14+
15+
16+
<p style="text-align:center;"> Sense is a client side library that enables you to identify users by pinpointing their hardware and software characteristics. This is done by computing a token that stays consistent in spite of any manipulation.</p>
17+
<p style="text-align:center;"> This tracking method works even in the browser's incognito mode and is not cleared by flushing the cache, closing the browser or restarting the operating system, using a VPN or installing AdBlockers. Sense is available as SenseOS for every open source requirement and is different from Sense PRO, our extremely accurate and detailed product.</p>
18+
19+
20+
<p style="text-align:center;"> Sense’s real time demo : https://pro.getsense.co/
21+
22+
*** Try visiting the same page in an incognito mode or switch on the VPN and
23+
notice how the visitor identifier remains the same in spite of all these changes!***
24+
25+
<h3 style="text-align:center;">Getting started with Sense </h3>
26+
27+
28+
## Sense - Android SDK
29+
30+
Sense is a device intelligence and identification tool. This tool collects a comprehensive set of attributes unique to a device or browser, forming an identity that will help businesses.
31+
Requirements
32+
33+
```
34+
* Use Android 5.1 (API level 21) and above.
35+
* Use Kotlin version 1.6.10 and above.
36+
* Add READ_PHONE_STATE Permission in Android Manifest for deivce information(Optional)
37+
```
38+
39+
Note: If the application does not have the listed permissions, the values collected using those permissions will be ignored. To provide a valid device details, we recommend employing as much permission as possible based on your use-case.
40+
41+
#### Step 1 - Add Dependency
42+
43+
Add the dependency in the app level build.gradle:
44+
45+
```
46+
dependencies {
47+
implementation 'io.github.sense-opensource:SenseOSUserActivity:0.0.1'
48+
}
49+
```
50+
51+
#### Step 2 - Import SDK
52+
53+
```
54+
import io.github.sense-opensource.SenseOSUserActivity
55+
56+
```
57+
58+
#### Step 3 - Initialize SDK
59+
60+
Add the following line of code to initialize it.
61+
62+
```
63+
64+
SenseOSUserActivity.initSDK(activity)
65+
66+
SenseOSUserActivity.initKeyStrokeBehaviour(context, email, password) // Here email and password are id of EditText Fields
67+
68+
SenseOSUserActivity.initTouchBehaviour(context, touchView) // Here touchView is id of Layout which needs to capture touch metrics
69+
70+
SenseOSUserActivity.initScrollBehaviour(scrollView) // Here scrollView is id of Layout which needs to capture scroll metrics
71+
72+
```
73+
74+
#### Step 4 - Get User Activity Details
75+
76+
Use the below code to get the User Activity Details
77+
78+
```
79+
Sense.getBehaviourData();
80+
```
81+
82+
#### Sample Program
83+
84+
Here you can find the demonstration to do the integration.
85+
86+
```
87+
import io.github.sense-opensource.SenseOSUserActivity
88+
import io.github.sense-opensource.SenseOSUserActivityConfig
89+
90+
class MainActivity : AppCompatActivity() {
91+
override fun onCreate(savedInstanceState: Bundle?) {
92+
super.onCreate(savedInstanceState)
93+
setContentView(R.layout.activity_main)
94+
95+
//Initialize SDK
96+
SenseOSUserActivity.initSDK(this)
97+
98+
val scrollView = view?.findViewById<ScrollView>(R.id.scrollView)
99+
val touchView = view?.findViewById<LinearLayout>(R.id.touchView)
100+
101+
val email = view?.findViewById<EditText>(R.id.public_key)
102+
val password = view?.findViewById<EditText>(R.id.secret_key)
103+
104+
if (email != null && password != null) {
105+
SenseOSUserActivity.initKeyStrokeBehaviour(requireContext(), email, password)
106+
}
107+
if (touchView != null) {
108+
SenseOSUserActivity.initTouchBehaviour(requireContext(), touchView)
109+
}
110+
if (scrollView != null) {
111+
SenseOSUserActivity.initScrollBehaviour(scrollView)
112+
}
113+
114+
// Fetch device details
115+
getUserActivityDetails();
116+
}
117+
private fun getUserActivityDetails() {
118+
val details = SenseOSUserActivity.getBehaviourData();
119+
println(details);
120+
}
121+
}
122+
```
123+
124+
<h4 style="text-align:center;">Plug and play, in just 3 steps</h3>
125+
126+
1️⃣ Visit the Git hub repository for the desired function : Validate your desired repository
127+
2️⃣ Download the code as a ZIP file : Host/clone the code in your local system or website
128+
3️⃣ Run the installer : Start testing the accuracy of your desired metrics
129+
130+
#### With Sense, you can
131+
132+
✅ Predict user intent : Identify the good from the bad visitors with precision
133+
✅ Create user identities : Tokenise events with a particular user and device
134+
✅ Custom risk signals : Developer specific scripts that perform unique functions
135+
✅ Protect against Identity spoofing : Prevent users from impersonation
136+
✅ Stop device or browser manipulation : Detect user behaviour anomalies
137+
138+
### Resources
139+
140+
#### MIT license :
141+
142+
Sense OS is available under the <a href="https://github.com/sense-opensource/sense-device-identity-android/blob/main/LICENSE"> MIT license </a>
143+
144+
#### Contributors code of conduct :
145+
146+
Thank you for your interest in contributing to this project! We welcome all contributions and are excited to have you join our community. Please read these <a href="https://github.com/sense-opensource/sense-device-identity-android/blob/main/code_of_conduct.md"> code of conduct </a> to ensure a smooth collaboration.
147+
148+
#### Where you can get support :
149+
![Gmail](https://img.shields.io/badge/Gmail-D14836?logo=gmail&logoColor=white) product@getsense.co
150+
151+
Public Support:
152+
For questions, bug reports, or feature requests, please use the Issues and Discussions sections on our repository. This helps the entire community benefit from shared knowledge and solutions.
153+
154+
Community Chat:
155+
Join our Discord server (link) to connect with other developers, ask questions in real-time, and share your feedback on Sense.
156+
157+
Interested in contributing to Sense?
158+
Please review our <a href="https://github.com/sense-opensource/sense-device-identity-android/blob/main/CONTRIBUTING.md"> Contribution Guidelines </a> to learn how to get started, submit pull requests, or run the project locally. We encourage you to read these guidelines carefully before making any contributions. Your input helps us make Sense better for everyone!

app/.gitignore

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#built application files
2+
*.apk
3+
*.ap_
4+
5+
# files for the dex VM
6+
*.dex
7+
8+
# Java class files
9+
*.class
10+
11+
# generated files
12+
bin/
13+
gen/
14+
15+
# Local configuration file (sdk path, etc)
16+
local.properties
17+
18+
# Windows thumbnail db
19+
Thumbs.db
20+
21+
# OSX files
22+
.DS_Store
23+
24+
# Eclipse project files
25+
.classpath
26+
.project
27+
28+
# Android Studio
29+
*.iml
30+
.idea/
31+
#.idea/workspace.xml - remove # and delete .idea if it better suit your needs.
32+
.gradle/
33+
build/
34+
35+
app/build/
36+
37+
gradle/
38+
39+
#NDK
40+
obj/
41+
42+
gradlew

app/build.gradle

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
plugins {
2+
id 'com.android.application'
3+
id 'org.jetbrains.kotlin.android'
4+
}
5+
6+
android {
7+
compileSdk 34
8+
9+
defaultConfig {
10+
applicationId "com.getsense"
11+
minSdk 21
12+
targetSdk 34
13+
versionCode 1
14+
versionName "1.0"
15+
16+
buildFeatures {
17+
dataBinding true
18+
}
19+
20+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
21+
}
22+
23+
buildTypes {
24+
release {
25+
minifyEnabled true
26+
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
27+
}
28+
debug {
29+
minifyEnabled true
30+
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
31+
}
32+
}
33+
compileOptions {
34+
sourceCompatibility JavaVersion.VERSION_11
35+
targetCompatibility JavaVersion.VERSION_11
36+
}
37+
kotlinOptions {
38+
jvmTarget = '11'
39+
}
40+
namespace 'com.getsense'
41+
}
42+
43+
dependencies {
44+
45+
implementation 'androidx.core:core-ktx:1.13.1'
46+
implementation 'androidx.appcompat:appcompat:1.7.0'
47+
implementation 'com.google.android.material:material:1.6.0'
48+
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
49+
implementation 'androidx.compose.ui:ui-graphics-android:1.7.4'
50+
implementation 'androidx.compose.material3:material3-android:1.3.0'
51+
implementation 'androidx.compose.foundation:foundation-android:1.7.4'
52+
implementation 'androidx.compose.runtime:runtime-android:1.7.4'
53+
testImplementation 'junit:junit:4.13.2'
54+
androidTestImplementation 'androidx.test.ext:junit:1.2.1'
55+
androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1'
56+
implementation project(path: ':sense')
57+
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
58+
implementation 'com.squareup.retrofit2:converter-jackson:2.9.0' // Use Jackson or Gson for JSON parsing
59+
implementation 'com.squareup.okhttp3:okhttp:4.10.0'
60+
implementation 'com.fasterxml.jackson.core:jackson-databind:2.15.2'
61+
implementation 'com.google.code.gson:gson:2.10.1' // Use the latest version
62+
implementation 'com.squareup.okhttp3:logging-interceptor:5.0.0-alpha.2'
63+
implementation 'com.squareup.retrofit2:converter-gson:2.11.0'
64+
implementation("androidx.activity:activity-ktx:1.6.1")
65+
implementation("androidx.fragment:fragment-ktx:1.5.6")
66+
67+
}

app/proguard-rules.pro

Whitespace-only changes.

app/src/main/AndroidManifest.xml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:tools="http://schemas.android.com/tools">
4+
<!-- <queries>-->
5+
<!-- &lt;!&ndash; Allows querying for installed apps &ndash;&gt;-->
6+
<!-- <package android:name="com.android.vending" />-->
7+
<!-- </queries>-->
8+
<uses-permission android:name="android.permission.INTERNET" />
9+
<!-- <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
10+
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
11+
<uses-permission android:name="android.permission.READ_PHONE_NUMBERS" />
12+
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
13+
<uses-permission android:name="android.permission.INTERNET" />
14+
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
15+
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
16+
17+
18+
<uses-permission android:name="android.permission.PACKAGE_USAGE_STATS" tools:ignore="ProtectedPermissions" />
19+
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES"
20+
tools:ignore="QueryAllPackagesPermission" /> -->
21+
22+
<application
23+
android:dataExtractionRules="@xml/data_extraction_rules"
24+
android:fullBackupContent="@xml/backup_rules"
25+
android:enableOnBackInvokedCallback="true"
26+
android:icon="@mipmap/ic_launcher"
27+
android:label="@string/app_name"
28+
android:roundIcon="@mipmap/ic_launcher_round"
29+
android:supportsRtl="true"
30+
android:theme="@style/Theme.SenseSDK"
31+
tools:targetApi="31">
32+
<activity
33+
android:name="com.getsense.MainActivity"
34+
android:exported="true">
35+
<intent-filter>
36+
<action android:name="android.intent.action.MAIN" />
37+
38+
<category android:name="android.intent.category.LAUNCHER" />
39+
</intent-filter>
40+
</activity>
41+
</application>
42+
43+
</manifest>
43.7 KB
Loading

0 commit comments

Comments
 (0)