ryuyoonju 07-30
240730 류윤주 1차 완성 코드 커밋
@86773933286f3654076367bb8b7a033cf64ce02d
android/app/src/main/AndroidManifest.xml
--- android/app/src/main/AndroidManifest.xml
+++ android/app/src/main/AndroidManifest.xml
@@ -9,6 +9,7 @@
     <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
     <uses-permission android:name="android.permission.WAKE_LOCK" />
     <uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
+    
 
     <application
       android:name=".MainApplication"
android/app/src/main/assets/index.android.bundle
--- android/app/src/main/assets/index.android.bundle
+++ android/app/src/main/assets/index.android.bundle
This diff is too big to display.
package-lock.json
--- package-lock.json
+++ package-lock.json
@@ -11,6 +11,7 @@
         "@react-native-async-storage/async-storage": "^1.23.1",
         "@react-navigation/native": "^6.1.17",
         "@react-navigation/stack": "^6.4.1",
+        "@sayem314/react-native-keep-awake": "^1.2.4",
         "axios": "^1.7.2",
         "base64-js": "^1.5.1",
         "crypto-js": "^4.2.0",
@@ -5880,6 +5881,15 @@
       "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
       "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
     },
+    "node_modules/@sayem314/react-native-keep-awake": {
+      "version": "1.2.4",
+      "resolved": "https://registry.npmjs.org/@sayem314/react-native-keep-awake/-/react-native-keep-awake-1.2.4.tgz",
+      "integrity": "sha512-I9tRpZ8z693lce4seDbRK0zBzeCkubBnSGmABiRPTRy2ZkMJB1m+vaXiDHl6U3fJa29i2TTaKclH3A8to/Bs9A==",
+      "funding": {
+        "type": "individual",
+        "url": "https://github.com/sponsors/sayem314"
+      }
+    },
     "node_modules/@sideway/address": {
       "version": "4.1.5",
       "resolved": "https://registry.npmjs.org/@sideway/address/-/address-4.1.5.tgz",
package.json
--- package.json
+++ package.json
@@ -13,6 +13,7 @@
     "@react-native-async-storage/async-storage": "^1.23.1",
     "@react-navigation/native": "^6.1.17",
     "@react-navigation/stack": "^6.4.1",
+    "@sayem314/react-native-keep-awake": "^1.2.4",
     "axios": "^1.7.2",
     "base64-js": "^1.5.1",
     "crypto-js": "^4.2.0",
src/screen/GpsScreen.js
--- src/screen/GpsScreen.js
+++ src/screen/GpsScreen.js
@@ -6,6 +6,7 @@
 import { useNavigation } from '@react-navigation/native';
 import Icon from 'react-native-vector-icons/FontAwesome';
 import Geolocation from 'react-native-geolocation-service';
+import { useKeepAwake } from '@sayem314/react-native-keep-awake';
 
 const GpsScreen = () => {
     const [isMeasuring, setIsMeasuring] = useState(false);
@@ -19,7 +20,9 @@
     }); // 위치 데이터 상태 수정
     const [watchId, setWatchId] = useState(null);
     const navigation = useNavigation();
-
+    //화면꺼짐방지
+    useKeepAwake();
+    //타이머
     useEffect(() => {
         let timer;
 
@@ -92,28 +95,35 @@
     const handleStop = async () => {
         setIsMeasuring(false);
         setElapsedTime(0);
-
+    
+        // 위치 데이터 초기화
+        setLocationData({
+            latitude: [],
+            longitude: [],
+            timestamp: []
+        });
+    
         if (watchId !== null) {
             Geolocation.clearWatch(watchId);
             setWatchId(null);
         }
-
+    
         try {
             const dataToSend = {
                 user_id: userId,
                 trip_id: tripId,
                 trip_log: locationData,
             };
-
+    
             console.log('Data to send:', dataToSend);
-
+    
             try {
                 const response = await Api.sendTripLog(dataToSend, navigation);
                 console.log("Response:", response);
             } catch (error) {
                 Alert.alert('로그인 실패', error.message);
             }
-
+    
         } catch (error) {
             console.error('Error stopping location tracking:', error);
         }
@@ -147,7 +157,7 @@
             (error) => {
                 console.error('위치 감시 중 오류:', error);
             },
-            { enableHighAccuracy: true, distanceFilter: 0, interval: 1000, fastestInterval: 1000, forceRequestLocation: true }
+            { enableHighAccuracy: true, distanceFilter: 1, interval: 1000, fastestInterval: 1000,  }
         );
 
         setWatchId(id);
Add a comment
List