Compare commits
5
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c45ce0d178 | ||
|
|
95c244b7f2 | ||
|
|
b720877fa5 | ||
|
|
0a4680e7b8 | ||
|
|
89f51e1b38 |
No files matched your search
@@ -130,10 +130,11 @@ 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));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
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;
|
||||||
@@ -12,6 +13,7 @@ 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;
|
||||||
@@ -169,7 +171,8 @@ public class SurveillanceService extends Service {
|
|||||||
* @return Bluetoothの権限の有無 true: 許可されていない false: 許可されている
|
* @return Bluetoothの権限の有無 true: 許可されていない false: 許可されている
|
||||||
*/
|
*/
|
||||||
private boolean isNotBluetoothGranted() {
|
private boolean isNotBluetoothGranted() {
|
||||||
if (ActivityCompat.checkSelfPermission(this, android.Manifest.permission.BLUETOOTH_CONNECT) != PackageManager.PERMISSION_GRANTED) {
|
String btPermission = getBluetoothConnectPermission();
|
||||||
|
if (ActivityCompat.checkSelfPermission(this, btPermission) != PackageManager.PERMISSION_GRANTED) {
|
||||||
Log.d(TAG, "Bluetoothの権限が許可されていません");
|
Log.d(TAG, "Bluetoothの権限が許可されていません");
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
@@ -190,6 +193,16 @@ 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のドキュメントリファレンス
|
||||||
|
|||||||
@@ -1,56 +1,74 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
tools:context=".SettingFragment"
|
android:padding="16dp"
|
||||||
android:padding="16dp">
|
tools:context=".SettingFragment">
|
||||||
|
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/linearLayout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:src="@drawable/bluetooth_and_qr2"
|
|
||||||
android:layout_gravity="center_horizontal"
|
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="200dp"
|
android:layout_height="200dp"
|
||||||
android:layout_marginTop="150dp"
|
android:layout_gravity="center_horizontal"
|
||||||
/>
|
android:src="@drawable/bluetooth_and_qr2" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:textColor="@color/black"
|
|
||||||
android:text="QRコード印刷とBluetooth設定"
|
|
||||||
android:layout_gravity="center_horizontal"
|
android:layout_gravity="center_horizontal"
|
||||||
android:textStyle="bold"
|
|
||||||
android:textSize="18dp"
|
|
||||||
android:layout_marginTop="20dp"
|
android:layout_marginTop="20dp"
|
||||||
/>
|
android:text="QRコード印刷とBluetooth設定"
|
||||||
|
android:textColor="@color/black"
|
||||||
|
android:textSize="18dp"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/button_bluetooth_setting"
|
android:id="@+id/button_bluetooth_setting"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="Bluetooth設定"
|
|
||||||
android:layout_marginTop="120dp"
|
android:layout_marginTop="120dp"
|
||||||
android:layout_marginBottom="20dp"/>
|
android:layout_marginBottom="20dp"
|
||||||
|
android:text="Bluetooth設定" />
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/button_print_qr"
|
android:id="@+id/button_print_qr"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="QRコード印刷"/>
|
android:text="QRコード印刷" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="bottom">
|
android:gravity="bottom"
|
||||||
|
app:layout_constraintBottom_toTopOf="@+id/linearLayout"
|
||||||
|
tools:layout_editor_absoluteX="16dp">
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="QRコードは株式会社デンソーウェーブの登録商標です"
|
android:text="QRコードは株式会社デンソーウェーブの登録商標です"
|
||||||
android:textColor="@color/black" />
|
android:textColor="@color/black"
|
||||||
</LinearLayout>
|
android:textSize="12sp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent" />
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
Reference in new issue
Block a user