3월, 2023의 게시물 표시

react native gps foreground service - android, kotlin (1)

react native 에서 gps 트래킹을 해야한다. 앱이 백그라운드에 있어도 동작하도록 네이티브 모듈을 만드는 것만 해도 많이 안하다보니 까다로운데 gps + 서비스 동작을 해야한다니. 기본으로 돌아가기로 했다. 일단 안드로이드 앱에서 GPS 트래킹하는 코드부터 시도해보았다. ### MainActivity.kt ``` package com.example.gpstracker import android.annotation.SuppressLint import android.content.Context import android.content.pm.PackageManager import android.location.LocationListener import android.location.LocationManager import android.os.Bundle import android.util.Log import androidx.activity.ComponentActivity import androidx.activity.compose.setContent import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.material3.Button import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Surface import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.core.app.ActivityCompat import com.example.gpstracker.ui.theme.GpsTrackerTheme val T

Transform react-native AppDelegate.mm to AppDelegate.swift

이미지
  Delete AppDelegate.h, AppDelegate.mm, main.m Make AppDelegate.swift & bridging-header Thankfully most of codes is wraped in RCTAppDelegate after RN0.71. So, as you can see, we should transform few codes from objective c to swift like below There is a you can’t just copy and paste. self.moduleName must be your ‘Project Name’ After making your own AppDelegate.swift and bridging-header, try to run using ‘npx react-native run-ios’ or ‘yarn ios’ wthatever you want. Then you can see this error.   In left, Project navigator displays, click your project > Build Settings > search ‘active com’ You can find Active Compilation Conditions. Add ‘DEBUG’ in Debug. It makes preprocessor recognize DEBUG flag. Run your application again after adding DEBUG flag. If you won’t use new architecture, this is it. To run this app suing new architecture, run the following in ios directory. bundle install && RCT_NEW_ARCH_ENABLED=1 bundle exec pod install If you run after pod install, you will

이 블로그의 인기 게시물

Operating System Concept

카카오 내비 리엑트 네이티브 모듈 만들기 ft.코틀린

Operating System Concepts 9th