How to get System ringtones/sounds - react-native

How can i get the list of system ringtones or storage ringtones/sounds in react native e.g ring tones, notification tones, so that i can give users choice to set them as notification tone?
I've searched some libraries but it didn't work

You can use this module if you are using Android. react-native-ringtone-manager
But it only use Android not ios
Usage
import RingtoneManager from 'react-native-ringtone-manager';
...
getRings() {
this.rings = RingtoneManager.getRingtones(RingtoneManager.TYPE_ALL);
if(this.rings != null) {this.rings = this.rings.map((data,index) =>{<Text>{data.title}</Text>})};
}

For iOS I tried react-native-notification-sounds npm pacakge .. But it gives all the sounds from the sound folder .. So you get a long list of sounds and no way to filter which is notification or ringtone sound.. Working on this

Related

How to publish LocalScreenShare tracks from IOS to Web browser in React-Native using Twilio

I want to integrate Screen Share feature in my react-native application in which I am using Twilio for video communication. In Web we are able to achieve this by following these steps.
1 : We get the media device stream using
navigator.mediaDevices.getDisplayMedia({
video: true,
});
2 : Then we get the first stream tracks using
const newScreenTrack = first(stream.getVideoTracks());
3 : After that we set this newScreenTrack in some useState
const localScreenTrack = new TwilioVideo.LocalVideoTrack(
newScreenTrack
);
4 : After that we first unpublish the previous tracks and publish the new tracks using
videoRoom.localParticipant.publishTrack(newScreenTrack, {
name: "screen_share",
});
5 : And finally we pass these tracks in our ScreenShare component and render these tracks to View the screenShare from remote Participant.
I need to do the same thing in my react-native application as well. Where if localParticipant ask for screenShare permission to another participant. Participant will accept the permission and able to publish the localScreenShare tracks.
If anyone know this please help me in this. It would be really helpful. Thank you
I think this is an issue with the react-native-twilio-video-webrtc package. It seems that, as you discovered in this issue, that screen sharing was previously a feature of the library and it was removed as part of a refactor.
Sadly, the library does more work than the underlying Twilio libraries to look after the video and audio tracks. The Twilio library is built to be able to publish more than one track at a time, however this React Native library allows you to publish a single audio track and a single video track using the camera at a time.
In order to add screen sharing, you can either support pull requests like this one or refactor the library to separate getting access to the camera from publishing a video track, so that you can publish multiple video tracks at a time, including screen tracks.

Can i use expo-linking for a phone call

I'm developing a mobile application using React Native Expo and I would like to be able to make a phone call with expo-linking and the list of my contacts with expo-contact if possible. Thanks
edit: i managed to do what i wanted
Hope it helps :)
import * as Linking from "expo-linking";
Linking.openURL('phone:+1786256252'); // phone
Linking.openURL('sms:+1786256252'); // sms
Linking.openURL('https://wa.me/+1786256252'); // whatsapp
Linking.openURL('https://t.me:+1786256252'); // telegram

How to read data in background in React Native

I have an app in React Native, that uses the bluetooth connection to read data from external devices.
I need a way to continue to read this data in background when, for example, the user starts a reading session and put the app in background.
What should I use to do this?
My code is divided in two parts:
Scan and Connect
Reading Data from external devices.
You need a background service for this. The following link for Android will help you.
github => react-native-foreground-service
If you want, you can do it yourself as described on the RN official site. But you'll have to write Java code for it.
React Native => Native Module

Not getting exact latitude longitude on ios device using watchPosition

Issue Description::
I am working on react native tracking application. Basically users check in from a certain place and they need to reach at the destination. Using this application we are finding out the path they are following. I need to get a geocodes from users check in location to destination to track the path he is following.
Now it builds a clean path in case of Android device, but having an issue with ios. For ios it takes a huge variation inside code.
I have tested this by traveling to same place using both devices(ios and android). For Android it's generates a exact latitude longitude values, but for ios there is a huge variation. Why this is happening. I have followed the official doc of react native for geolocation setup.
You can check this link:: https://facebook.github.io/react-native/docs/geolocation.html#ios
We are using react native geolocation service package, GitHub link
This is happening when I have updated react native version to 0.58
Code::
this.watchId = Geolocation.watchPosition((response) => {
this.currentWatchLocationTimeout = this.currentWatchLocationTimeout + WATCH_LOCATION_TIMEOUT;
currentPosition.lat = this.convertToDecimalPoints(response.coords.latitude);
currentPosition.lng = this.convertToDecimalPoints(response.coords.longitude);
//... additional code
}, (error) => {
this.onGeolocationErrorOccurCallback(error);
}, {
enableHighAccuracy: true,
distanceFilter: 5,
showLocationDialog: true
});
Additional Information ::
React Native: 0.58
react-native-geolocation-service: 2.0.0
platform: ios(only)
Best solution that works for me is changes inside react native geolocation files. You need to replace some lines of code. Go inside react native package,
react-native/Libraries/Geolocation/RCTLocationObserver.m
Then replace this line::
#define RCT_DEFAULT_LOCATION_ACCURACY kCLLocationAccuracyHundredMeters
with this::
#define RCT_DEFAULT_LOCATION_ACCURACY 0.0
After this replace this line::
.accuracy = [RCTConvert BOOL:options[#"enableHighAccuracy"]] ? kCLLocationAccuracyBest : RCT_DEFAULT_LOCATION_ACCURACY,
with this one::
.accuracy = RCT_DEFAULT_LOCATION_ACCURACY,
You need to directly search for these lines on above mentioned path.
I found this inside git commits, you can also check this link:: link

codepush react native new package

I tried react native code push and it works flawlessly. Let's say I modify the text in my buttons to say something else, then with a single command, the update is sent to the users.
Now, lets say I am using a new npm library which requires some native code. Say react-native-image-picker (https://github.com/react-community/react-native-image-picker). Can code push handles this? I want the image picker functionality to be updated too in my users app. Thank you.
No - CodePush can only update JavaScript code and images.
CodePush does not update native code at all so any changes to native code require a full app build and deploy via the relevant app store or app distribution tool (e.g. HockeyApp).
Note: There are some limitations around images - full details here.