Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8c22c8a

Browse files
feat : kotlinize crash snippets
1 parent 28855b2 commit 8c22c8a

File tree

4 files changed

+47
-1
lines changed

4 files changed

+47
-1
lines changed

crash/app/src/main/AndroidManifest.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
</activity>
1818
<activity android:name=".KotlinMainActivity" />
1919
<activity android:name="com.google.firebase.example.crash.MainActivity"></activity>
20+
<activity android:name="com.google.firebase.example.crash.KotlinMainActivity" />
2021
</application>
2122

2223
</manifest>
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package com.google.firebase.example.crash
2+
3+
import android.os.Bundle
4+
import android.support.v7.app.AppCompatActivity
5+
import com.google.firebase.crash.FirebaseCrash
6+
import com.google.firebase.example.crash.interfaces.MainActivityInterface
7+
8+
class KotlinMainActivity : AppCompatActivity(), MainActivityInterface {
9+
10+
override fun onCreate(savedInstanceState: Bundle?) {
11+
super.onCreate(savedInstanceState)
12+
}
13+
14+
override fun logSimple() {
15+
// [START crash_log_simple]
16+
FirebaseCrash.log("Activity created")
17+
// [END crash_log_simple]
18+
}
19+
20+
override fun disableCollection() {
21+
// [START crash_disable_collection]
22+
FirebaseCrash.setCrashCollectionEnabled(false)
23+
// [END crash_disable_collection]
24+
}
25+
26+
override fun enableCollection() {
27+
// [START crash_enable_collection]
28+
FirebaseCrash.setCrashCollectionEnabled(true)
29+
// [END crash_enable_collection]
30+
}
31+
32+
}

crash/app/src/main/java/com/google/firebase/example/crash/MainActivity.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
import android.support.v7.app.AppCompatActivity;
55

66
import com.google.firebase.crash.FirebaseCrash;
7+
import com.google.firebase.example.crash.interfaces.MainActivityInterface;
78

8-
public class MainActivity extends AppCompatActivity {
9+
public class MainActivity extends AppCompatActivity implements MainActivityInterface {
910

1011
@Override
1112
protected void onCreate(Bundle savedInstanceState) {
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package com.google.firebase.example.crash.interfaces
2+
3+
/**
4+
* An interface to be implemented by the Activity.
5+
* Add any new method to this interface instead of adding it directly to the activity
6+
*/
7+
8+
interface MainActivityInterface {
9+
fun logSimple()
10+
fun disableCollection()
11+
fun enableCollection()
12+
}

0 commit comments

Comments
 (0)