Skip to content

Commit 2beab4b

Browse files
authored
Merge pull request #200 from Microsoft/develop
0.1.2 release merge
2 parents e3e300a + 7e307cc commit 2beab4b

File tree

34 files changed

+861
-193
lines changed

34 files changed

+861
-193
lines changed

.idea/shelf/sasquatch_release_patch.xml

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/shelf/sasquatch_release_patch/shelved.patch

Lines changed: 49 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,16 +73,12 @@ Now that you've integrated the SDK in your application, it's time to start the S
7373
7474
To start the Sonoma SDK in your app, follow these steps:
7575
76-
1. **Get the App Secret of your application:** Before you call the API to start the SDK, you need to get your app specific Application Secret from the Sonoma portal that needs to be a part of the method call. This will make sure all the data collected by the SDK corresponds to your application.
77-
78-
Go over to the Sonoma portal, click on "Microsoft Azure Sonoma". Under "My apps", click on the app that you want the SDK to set up for. Then click on "Manage app" and make note of the "App Secret" value.
79-
80-
2. **Start the SDK:** Sonoma provides developers with two modules to get started – Analytics and Crashes. In order to use these modules, you need to opt in for the module(s) that you'd like, meaning by default no modules are started and you will have to explicitly call each of them when starting the SDK. Insert the following line inside your app's main activity class' `onCreate` callback.
76+
1. **Start the SDK:** Sonoma provides developers with two modules to get started – Analytics and Crashes. In order to use these modules, you need to opt in for the module(s) that you'd like, meaning by default no modules are started and you will have to explicitly call each of them when starting the SDK. Insert the following line inside your app's main activity class' `onCreate` callback.
8177
8278
```Java
8379
Sonoma.start(getApplication(), "{Your App Secret}", Analytics.class, Crashes.class);
8480
```
85-
Make sure to replace {Your App Secret} text with the actual value for your application.
81+
You can also copy paste the `start` method call from the Overview page on Sonoma portal once your app is selected. It already includes the App Secret so that all the data collected by the SDK corresponds to your application. Make sure to replace {Your App Secret} text with the actual value for your application.
8682
8783
The example above shows how to use the `start()` method and include both the Analytics and Crashes module. If you wish not to use Analytics, remove the parameter from the method call above. Note that, unless you explicitly specify each module as parameters in the start method, you can't use that Sonoma service. Also, the `start()` API can be used only once in the lifecycle of your app – all other calls will log a warning to the console and only the modules included in the first call will be available.
8884

apps/helloworld/build.gradle

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ repositories {
1919
}
2020

2121
dependencies {
22-
//noinspection GradleDynamicVersion
23-
compile "com.microsoft.sonoma:analytics:+"
24-
//noinspection GradleDynamicVersion
25-
compile "com.microsoft.sonoma:crashes:+"
22+
def version = "0.1.1"
23+
compile "com.microsoft.sonoma:analytics:${version}"
24+
compile "com.microsoft.sonoma:crashes:${version}"
2625
}

apps/helloworld/src/main/java/com/microsoft/sonoma/helloworld/HelloWorldActivity.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
import com.microsoft.sonoma.analytics.Analytics;
88
import com.microsoft.sonoma.core.Sonoma;
9-
import com.microsoft.sonoma.core.utils.UUIDUtils;
109
import com.microsoft.sonoma.crashes.Crashes;
1110

1211
public class HelloWorldActivity extends Activity {
@@ -17,7 +16,7 @@ protected void onCreate(Bundle savedInstanceState) {
1716
setContentView(R.layout.activity_main);
1817

1918
Sonoma.setLogLevel(Log.VERBOSE);
20-
Sonoma.start(getApplication(), UUIDUtils.randomUUID().toString(), Analytics.class, Crashes.class);
19+
Sonoma.start(getApplication(), "45d1d9f6-2492-4e68-bd44-7190351eb5f3", Analytics.class, Crashes.class);
2120
}
2221

2322
@SuppressWarnings({"ConstantConditions", "ConstantIfStatement"})
Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3-
xmlns:tools="http://schemas.android.com/tools"
4-
package="com.microsoft.sonoma.sasquatch">
3+
xmlns:tools="http://schemas.android.com/tools"
4+
package="com.microsoft.sonoma.sasquatch">
55

66
<application
77
android:allowBackup="true"
@@ -10,19 +10,31 @@
1010
android:supportsRtl="true"
1111
android:theme="@style/AppTheme"
1212
tools:ignore="AllowBackup,GoogleAppIndexingWarning">
13-
<activity android:name="com.microsoft.sonoma.sasquatch.activities.MainActivity">
13+
<activity android:name=".activities.MainActivity">
1414
<intent-filter>
15-
<action android:name="android.intent.action.MAIN"/>
15+
<action android:name="android.intent.action.MAIN" />
1616

17-
<category android:name="android.intent.category.LAUNCHER"/>
17+
<category android:name="android.intent.category.LAUNCHER" />
1818
</intent-filter>
1919
</activity>
20-
21-
<activity android:name="com.microsoft.sonoma.sasquatch.activities.DeviceInfoActivity"/>
22-
<activity android:name="com.microsoft.sonoma.sasquatch.activities.EventActivity"/>
23-
<activity android:name="com.microsoft.sonoma.sasquatch.activities.PageActivity"/>
24-
<activity android:name="com.microsoft.sonoma.sasquatch.activities.DummyActivity"/>
25-
<activity android:name="com.microsoft.sonoma.sasquatch.activities.SettingsActivity"/>
20+
<activity
21+
android:name=".activities.DeviceInfoActivity"
22+
android:label="@string/title_device_info" />
23+
<activity
24+
android:name=".activities.EventActivity"
25+
android:label="@string/title_event" />
26+
<activity
27+
android:name=".activities.PageActivity"
28+
android:label="@string/title_page" />
29+
<activity
30+
android:name=".activities.DummyActivity"
31+
android:label="@string/title_generate_page_log" />
32+
<activity
33+
android:name=".activities.SettingsActivity"
34+
android:label="@string/settings" />
35+
<activity
36+
android:name=".activities.ManagedErrorActivity"
37+
android:label="@string/title_error" />
2638
</application>
2739

2840
</manifest>
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
package com.microsoft.sonoma.sasquatch.activities;
2+
3+
import android.os.Bundle;
4+
import android.support.annotation.NonNull;
5+
import android.support.annotation.Nullable;
6+
import android.support.v7.app.AppCompatActivity;
7+
import android.view.View;
8+
import android.view.ViewGroup;
9+
import android.widget.AdapterView;
10+
import android.widget.ArrayAdapter;
11+
import android.widget.ListView;
12+
import android.widget.TextView;
13+
14+
import com.microsoft.sonoma.crashes.Crashes;
15+
import com.microsoft.sonoma.sasquatch.R;
16+
17+
import java.util.Arrays;
18+
import java.util.List;
19+
20+
public class ManagedErrorActivity extends AppCompatActivity {
21+
22+
private static final List<Class<? extends Throwable>> sSupportedThrowables = Arrays.asList(
23+
ArithmeticException.class,
24+
ArrayIndexOutOfBoundsException.class,
25+
ArrayStoreException.class,
26+
ClassCastException.class,
27+
ClassNotFoundException.class,
28+
CloneNotSupportedException.class,
29+
IllegalAccessException.class,
30+
IllegalArgumentException.class,
31+
IllegalMonitorStateException.class,
32+
IllegalStateException.class,
33+
IllegalThreadStateException.class,
34+
IndexOutOfBoundsException.class,
35+
InstantiationException.class,
36+
InterruptedException.class,
37+
NegativeArraySizeException.class,
38+
NoSuchFieldException.class,
39+
NoSuchMethodException.class,
40+
NullPointerException.class,
41+
NumberFormatException.class,
42+
SecurityException.class,
43+
UnsupportedOperationException.class,
44+
AssertionError.class,
45+
LinkageError.class,
46+
ThreadDeath.class,
47+
VirtualMachineError.class);
48+
49+
@Override
50+
protected void onCreate(Bundle savedInstanceState) {
51+
super.onCreate(savedInstanceState);
52+
setContentView(R.layout.activity_managed_error);
53+
54+
ListView listView = (ListView) findViewById(R.id.throwables_list_view);
55+
listView.setAdapter(new ArrayAdapter<Class<? extends Throwable>>(this, android.R.layout.simple_list_item_1, sSupportedThrowables) {
56+
@SuppressWarnings("ConstantConditions")
57+
@NonNull
58+
@Override
59+
public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
60+
View view = super.getView(position, convertView, parent);
61+
((TextView) view.findViewById(android.R.id.text1)).setText(getItem(position).getSimpleName());
62+
return view;
63+
}
64+
});
65+
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
66+
@Override
67+
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
68+
try {
69+
@SuppressWarnings("unchecked")
70+
Class<? extends Throwable> clazz = (Class<? extends Throwable>) parent.getItemAtPosition(position);
71+
Crashes.trackException(clazz.getConstructor(String.class).newInstance("Test Exception"));
72+
} catch (Exception e) {
73+
74+
/* This is not expected behavior so let the application crashes. */
75+
throw new RuntimeException(e);
76+
}
77+
}
78+
});
79+
}
80+
}

apps/sasquatch/src/main/java/com/microsoft/sonoma/sasquatch/features/TestFeatures.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import com.microsoft.sonoma.sasquatch.activities.DeviceInfoActivity;
1111
import com.microsoft.sonoma.sasquatch.activities.DummyActivity;
1212
import com.microsoft.sonoma.sasquatch.activities.EventActivity;
13+
import com.microsoft.sonoma.sasquatch.activities.ManagedErrorActivity;
1314
import com.microsoft.sonoma.sasquatch.activities.PageActivity;
1415

1516
import java.lang.ref.WeakReference;
@@ -34,6 +35,7 @@ public void onClick(View v) {
3435
}
3536
}));
3637
sTestFeatureModel.add(new TestFeatureModel(R.string.title_device_info, R.string.description_device_info, DeviceInfoActivity.class));
38+
sTestFeatureModel.add(new TestFeatureModel(R.string.title_error, R.string.description_error, ManagedErrorActivity.class));
3739
sTestFeatureModel.add(new TestFeatureModel(R.string.title_event, R.string.description_event, EventActivity.class));
3840
sTestFeatureModel.add(new TestFeatureModel(R.string.title_page, R.string.description_page, PageActivity.class));
3941
sTestFeatureModel.add(new TestFeatureModel(R.string.title_generate_page_log, R.string.description_generate_page_log, DummyActivity.class));
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:tools="http://schemas.android.com/tools"
4+
android:layout_width="match_parent"
5+
android:layout_height="match_parent"
6+
android:paddingBottom="@dimen/activity_vertical_margin"
7+
android:paddingLeft="@dimen/activity_horizontal_margin"
8+
android:paddingRight="@dimen/activity_horizontal_margin"
9+
android:paddingTop="@dimen/activity_vertical_margin"
10+
tools:context=".activities.ManagedErrorActivity">
11+
12+
<ListView
13+
android:id="@+id/throwables_list_view"
14+
android:layout_width="match_parent"
15+
android:layout_height="match_parent" />
16+
</LinearLayout>

apps/sasquatch/src/main/res/values/strings.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
<string name="title_generate_page_log">Generate page logs</string>
1010
<string name="description_generate_page_log">Simulate page open and close 5 times</string>
1111
<string name="error_device_info">Couldn\'t retrieve device information</string>
12+
<string name="title_error">Errors</string>
13+
<string name="description_error">Send an exception</string>
1214
<string name="title_event">Events</string>
1315
<string name="description_event">Send a custom event</string>
1416
<string name="title_page">Pages</string>

0 commit comments

Comments
 (0)