Skip to content

Commit e705495

Browse files
authored
Merge pull request #551 from Countly/staging
Staging 26.1.2
2 parents b8c5ddc + 5ac9cd6 commit e705495

67 files changed

Lines changed: 6501 additions & 1923 deletions

File tree

Some content is hidden

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

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
## 26.1.2
2+
* Added `CountlyInitProvider` ContentProvider to register activity lifecycle callbacks before `Application.onCreate()`. This ensures the SDK captures the current activity in single-activity frameworks (Flutter, React Native) and apps with deferred initialization.
3+
* Added `CountlyConfig.setInitialActivity(Activity)` as an explicit way for wrapper SDKs to provide the host activity during initialization.
4+
* Added a new config option `setMetricProvider(MetricProvider)` to allow overriding default device metrics with custom values.
5+
6+
## 26.1.1
7+
* Added Content feature method `previewContent(String contentId)` (Experimental!).
8+
* Improved content display and refresh mechanics.
9+
10+
* Mitigated an issue about health checks storage in explicit storage mode.
11+
112
## 26.1.0
213
* Extended server configuration capabilities with server-controlled listing filters:
314
* Event filters (blacklist/whitelist) to control which events are recorded.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/b26d1acc435c47af88b4e4b9eb94f59f)](https://app.codacy.com/gh/Countly/countly-sdk-android/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade)
2-
[![API](https://img.shields.io/badge/API-9%2B-brightgreen.svg?style=flat)](https://android-arsenal.com/api?level=9)
2+
![API](https://img.shields.io/badge/API-21%2B-brightgreen.svg?style=flat)
33

44
# Countly Android SDK
55

app-kotlin/build.gradle

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,7 @@ android {
2525
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
2626
}
2727
}
28-
compileOptions {
29-
sourceCompatibility JavaVersion.VERSION_1_8
30-
targetCompatibility JavaVersion.VERSION_1_8
31-
}
32-
33-
kotlinOptions {
34-
jvmTarget = '1.8'
35-
}
28+
3629
dataBinding {
3730
enabled = true
3831
}

app/build.gradle

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,19 @@ repositories {
2828
}
2929
}
3030

31+
kotlin {
32+
jvmToolchain(17)
33+
}
34+
3135
android {
3236
compileSdk 35
3337
namespace 'ly.count.android.demo'
3438

39+
compileOptions {
40+
sourceCompatibility JavaVersion.VERSION_17
41+
targetCompatibility JavaVersion.VERSION_17
42+
}
43+
3544
signingConfigs {
3645
release {
3746
storeFile file('keys')

app/src/main/AndroidManifest.xml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
<activity
2121
android:name=".MainActivity"
2222
android:label="@string/app_name"
23+
android:theme="@style/AppTheme.NoActionBar"
2324
android:configChanges="orientation|screenSize"
2425
android:exported="true">
2526
<intent-filter>
@@ -105,6 +106,11 @@
105106
android:label="@string/activity_name_content_zone"
106107
android:configChanges="orientation|screenSize"/>
107108

109+
<activity
110+
android:name=".ActivityExampleFragments"
111+
android:label="Fragment Navigation Test"
112+
android:configChanges="orientation|screenSize"/>
113+
108114
<activity
109115
android:name=".ActivityExampleTests"
110116
android:exported="false"/>
@@ -149,6 +155,21 @@
149155
</intent-filter>
150156
</activity>
151157
<activity android:name=".ActivityExampleKotlin"/>
158+
159+
<activity
160+
android:name=".ActivityExampleConsent"
161+
android:label="@string/activity_name_consent"
162+
android:configChanges="orientation|screenSize"/>
163+
164+
<activity
165+
android:name=".ActivityExampleLocation"
166+
android:label="@string/activity_name_location"
167+
android:configChanges="orientation|screenSize"/>
168+
169+
<activity
170+
android:name=".ActivityExampleSessions"
171+
android:label="@string/activity_name_sessions"
172+
android:configChanges="orientation|screenSize"/>
152173
</application>
153174

154175
</manifest>
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
package ly.count.android.demo;
2+
3+
import android.os.Bundle;
4+
import android.widget.Toast;
5+
6+
import androidx.appcompat.app.AppCompatActivity;
7+
8+
import com.google.android.material.switchmaterial.SwitchMaterial;
9+
10+
import ly.count.android.sdk.Countly;
11+
12+
public class ActivityExampleConsent extends AppCompatActivity {
13+
14+
private static final String[][] FEATURES = {
15+
{"sessions", "switchSessions"},
16+
{"events", "switchEvents"},
17+
{"views", "switchViews"},
18+
{"crashes", "switchCrashes"},
19+
{"attribution", "switchAttribution"},
20+
{"users", "switchUsers"},
21+
{"push", "switchPush"},
22+
{"starRating", "switchStarRating"},
23+
{"remoteConfig", "switchRemoteConfig"},
24+
{"location", "switchLocation"},
25+
{"feedback", "switchFeedback"},
26+
{"apm", "switchApm"},
27+
{"content", "switchContent"},
28+
};
29+
30+
@Override
31+
public void onCreate(Bundle savedInstanceState) {
32+
super.onCreate(savedInstanceState);
33+
setContentView(R.layout.activity_example_consent);
34+
35+
// Set initial switch states and listeners
36+
for (String[] feature : FEATURES) {
37+
String featureName = feature[0];
38+
int resId = getResources().getIdentifier(feature[1], "id", getPackageName());
39+
SwitchMaterial sw = findViewById(resId);
40+
if (sw != null) {
41+
sw.setChecked(Countly.sharedInstance().consent().getConsent(featureName));
42+
sw.setOnCheckedChangeListener((buttonView, isChecked) -> {
43+
if (isChecked) {
44+
Countly.sharedInstance().consent().giveConsent(new String[]{featureName});
45+
} else {
46+
Countly.sharedInstance().consent().removeConsent(new String[]{featureName});
47+
}
48+
});
49+
}
50+
}
51+
52+
findViewById(R.id.btnGiveAllConsent).setOnClickListener(v -> {
53+
Countly.sharedInstance().consent().giveConsentAll();
54+
refreshSwitches();
55+
Toast.makeText(this, "All consent given", Toast.LENGTH_SHORT).show();
56+
});
57+
58+
findViewById(R.id.btnRemoveAllConsent).setOnClickListener(v -> {
59+
Countly.sharedInstance().consent().removeConsentAll();
60+
refreshSwitches();
61+
Toast.makeText(this, "All consent removed", Toast.LENGTH_SHORT).show();
62+
});
63+
}
64+
65+
private void refreshSwitches() {
66+
for (String[] feature : FEATURES) {
67+
int resId = getResources().getIdentifier(feature[1], "id", getPackageName());
68+
SwitchMaterial sw = findViewById(resId);
69+
if (sw != null) {
70+
sw.setChecked(Countly.sharedInstance().consent().getConsent(feature[0]));
71+
}
72+
}
73+
}
74+
}

app/src/main/java/ly/count/android/demo/ActivityExampleContentZone.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,6 @@ public void onClickChangeDeviceIdContentZone(View v) {
3838
String newDeviceId = deviceId.isEmpty() ? UUID.randomUUID().toString() : deviceId;
3939

4040
Countly.sharedInstance().deviceId().setID(newDeviceId);
41+
Countly.sharedInstance().consent().giveConsentAll();
4142
}
4243
}

0 commit comments

Comments
 (0)