diff --git a/app/src/main/kotlin/jackall/overlaymulticounter/activity/MainActivity.kt b/app/src/main/kotlin/jackall/overlaymulticounter/activity/MainActivity.kt index f376290..99c8992 100644 --- a/app/src/main/kotlin/jackall/overlaymulticounter/activity/MainActivity.kt +++ b/app/src/main/kotlin/jackall/overlaymulticounter/activity/MainActivity.kt @@ -4,7 +4,9 @@ import android.os.Bundle import android.support.v7.app.AppCompatActivity import jackall.overlaymulticounter.R +import jackall.overlaymulticounter.db.CounterRealmHelper import jackall.overlaymulticounter.service.MainService +import jackall.overlaymulticounter.vo.Counter class MainActivity : AppCompatActivity() { @@ -12,6 +14,14 @@ super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) + if (CounterRealmHelper().getNextId() == 0) { + CounterRealmHelper().insert( + Counter(CounterRealmHelper().getNextId(), + "カウンター1", + 0) + ) + } + // TODO: RuntimePermissionの処理 startService(Intent(this, MainService::class.java)) }