Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not working when mobile in sleep mode[Android] #215

Open
theoduong05 opened this issue May 14, 2023 · 1 comment
Open

Not working when mobile in sleep mode[Android] #215

theoduong05 opened this issue May 14, 2023 · 1 comment

Comments

@theoduong05
Copy link

RNLocation not working in Android when mobile in sleep mode but the same configuration method works well in iOS.
RNLocation.configure({ distanceFilter: 10, // Meters desiredAccuracy: { ios: "best", android: "highAccuracy" }, // Android only androidProvider: "auto", interval: 2000, // Milliseconds fastestInterval: 20000, // Milliseconds maxWaitTime: 10000, // Milliseconds // iOS Only activityType: "other", allowsBackgroundLocationUpdates: true, headingFilter: 1, // Degrees headingOrientation: "portrait", pausesLocationUpdatesAutomatically: false, showsBackgroundLocationIndicator: true, })
Get Location using RNLocation.subscribeToLocationUpdates method.
AndroidManifest:
`

<uses-permission android:name="android.permission.INTERNET" />
<!-- <uses-permission android:name="android.permission.CAMERA" /> -->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
<uses-permission android:name="android.permission.WAKE_LOCK" />

<!-- optionally, if you want to record audio: -->
<uses-permission android:name="android.permission.RECORD_AUDIO" />

<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" />

<application
  android:name=".MainApplication"
  android:label="@string/app_name"
  android:icon="@mipmap/ic_launcher"
  android:roundIcon="@mipmap/ic_launcher_round"
  android:allowBackup="false"
  android:theme="@style/AppTheme">
  <service android:name="com.asterinet.react.bgactions.RNBackgroundActionsTask" />
  <meta-data
    android:name="com.supersami.foregroundservice.notification_channel_name"
    android:value="Sticky Title"
  />
  <meta-data
    android:name="com.supersami.foregroundservice.notification_channel_description"
    android:value="Sticky Description."
  />
  <meta-data
    android:name="com.supersami.foregroundservice.notification_color"
    android:resource="@color/blue"
  />
  <service android:name="com.supersami.foregroundservice.ForegroundService"></service>
  <service android:name="com.supersami.foregroundservice.ForegroundServiceTask"></service>

  <activity
    android:name=".MainActivity"
    android:label="@string/app_name"
    android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize|uiMode"
    android:launchMode="singleTask"
    android:windowSoftInputMode="adjustResize"
    android:exported="true">
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
  </activity>
  <service
    android:name="com.voximplant.foregroundservice.VIForegroundService"
    android:foregroundServiceType="location"
    android:exported="false">
  </service>
</application>
`
@ahmadmalindo
Copy link

call permission PermissionAndroid in React native for documentation chek https://reactnative.dev/docs/permissionsandroid

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants