TestServiceの全体的なリファクタリング #28

Merged
asura146 merged 73 commits from improve/refactor_service into main 2024-07-12 02:17:26 +00:00
Showing only changes of commit e257038e40 - Show all commits

View File

@ -136,6 +136,8 @@ public class MainActivity extends AppCompatActivity {
} }
registerReceiver(receiver, intentFilter); registerReceiver(receiver, intentFilter);
startForegroundService(new Intent(this, TestService.class));
} }
@ -334,8 +336,8 @@ public class MainActivity extends AppCompatActivity {
@Override @Override
public void onStop() {//アプリをバックグラウンドにした時のメソッド public void onStop() {//アプリをバックグラウンドにした時のメソッド
super.onStop(); super.onStop();
Intent intent = new Intent(getApplication(), TestService.class); // Intent intent = new Intent(getApplication(), TestService.class);
startService(intent);//TestServiceを起動 // startService(intent);//TestServiceを起動
} }
public void NotificationBluetooth(Context context) {//実際に通知を行うメソッド public void NotificationBluetooth(Context context) {//実際に通知を行うメソッド