Compare commits

..

No commits in common. "b720877fa53634a9627b89c8b6b5a5a5839421e7" and "4046eac506e84d06a7d75c944728a1d520178787" have entirely different histories.

2 changed files with 4 additions and 18 deletions

View File

@ -130,11 +130,10 @@ public class MainActivity extends AppCompatActivity {
return; return;
} else { } else {
Log.d("BT", "Permission to connect bluetooth devices granted"); Log.d("BT", "Permission to connect bluetooth devices granted");
}
registerReceiver(receiver, intentFilter); registerReceiver(receiver, intentFilter);
startForegroundService(new Intent(this, SurveillanceService.class)); //startForegroundService(new Intent(this, SurveillanceService.class));
}
} }

View File

@ -1,6 +1,5 @@
package com.example.childguard; package com.example.childguard;
import android.Manifest;
import android.app.Notification; import android.app.Notification;
import android.app.NotificationChannel; import android.app.NotificationChannel;
import android.app.NotificationManager; import android.app.NotificationManager;
@ -13,7 +12,6 @@ import android.content.Intent;
import android.content.IntentFilter; import android.content.IntentFilter;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.os.Build;
import android.os.Handler; import android.os.Handler;
import android.os.IBinder; import android.os.IBinder;
import android.os.VibrationEffect; import android.os.VibrationEffect;
@ -171,8 +169,7 @@ public class SurveillanceService extends Service {
* @return Bluetoothの権限の有無 true: 許可されていない false: 許可されている * @return Bluetoothの権限の有無 true: 許可されていない false: 許可されている
*/ */
private boolean isNotBluetoothGranted() { private boolean isNotBluetoothGranted() {
String btPermission = getBluetoothConnectPermission(); if (ActivityCompat.checkSelfPermission(this, android.Manifest.permission.BLUETOOTH_CONNECT) != PackageManager.PERMISSION_GRANTED) {
if (ActivityCompat.checkSelfPermission(this, btPermission) != PackageManager.PERMISSION_GRANTED) {
Log.d(TAG, "Bluetoothの権限が許可されていません"); Log.d(TAG, "Bluetoothの権限が許可されていません");
return true; return true;
} else { } else {
@ -193,16 +190,6 @@ public class SurveillanceService extends Service {
registerReceiver(receiver, intentFilter); registerReceiver(receiver, intentFilter);
} }
/**
* Bluetoothの接続権限を取得
* @return Bluetoothの接続権限
*/
private String getBluetoothConnectPermission() {
return (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) ?
android.Manifest.permission.BLUETOOTH_CONNECT :
Manifest.permission.BLUETOOTH;
}
/** /**
* Firestoreのスナップショットリスナーを設定 * Firestoreのスナップショットリスナーを設定
* @param mDocRef Firestoreのドキュメントリファレンス * @param mDocRef Firestoreのドキュメントリファレンス