-
Notifications
You must be signed in to change notification settings - Fork 291
Expand file tree
/
Copy pathActivityExampleContentZone.java
More file actions
43 lines (34 loc) · 1.34 KB
/
ActivityExampleContentZone.java
File metadata and controls
43 lines (34 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package ly.count.android.demo;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import androidx.appcompat.app.AppCompatActivity;
import java.util.UUID;
import ly.count.android.sdk.Countly;
public class ActivityExampleContentZone extends AppCompatActivity {
Activity activity;
EditText deviceIdEditText;
@Override
public void onCreate(Bundle savedInstanceState) {
activity = this;
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_example_content_zone);
deviceIdEditText = findViewById(R.id.editTextDeviceIdContentZone);
}
public void onClickEnterContentZone(View v) {
Countly.sharedInstance().contents().enterContentZone();
}
public void onClickExitContentZone(View v) {
Countly.sharedInstance().contents().exitContentZone();
}
public void onClickRefreshContentZone(View v) {
Countly.sharedInstance().contents().refreshContentZone();
}
public void onClickChangeDeviceIdContentZone(View v) {
String deviceId = deviceIdEditText.getText().toString();
String newDeviceId = deviceId.isEmpty() ? UUID.randomUUID().toString() : deviceId;
Countly.sharedInstance().deviceId().setID(newDeviceId);
Countly.sharedInstance().consent().giveConsentAll();
}
}