React Native local Notification by background service of App - react-native

I want to show notification when new post available in react native app.
when ever my app open it fetch latest PostID{POSTID is auto increment in online database} and save the latest PostID in Mobile database.
But now if App close it should check in background by fetching after every 15min about new postID and compare it with the saved PostID.
If saved PostID is smaller then received PostID then it should show notification of new post.

you could use react-native-firebase, it encapsulate Local notifications feature since version 4+...
Problem: this version is only compatible with Gradle 3+, which React Native doesn't support yet (RN 0.56 still runs with gradle 2.3.3)
An alternative in the meantime is - react-native-fcm' - they're dropping development in favor of react native firebase, but has the feature you want.
You could even copy/paste the code you need if you don't want the whole 3rd party lib...

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.

is it possible to replace existing react native app with a new one?

I have a react native project on 0. 59 version and I tried to do major updates to 0. 60. But it seems to be impossible I can not run the app on the emulator. So I had this idea of creating an empty project and to transfer my code on it. Has someone ever done something like this?
Is there a way to link existing app on the app store with a new
Yes, you can start a complete new app and replace it in the App Store with the new one.
The app is only identified by the bundle identifier (iOS) or the applicationId (android).
But I would recommend using upgrade helper before migrating to a new project.

Download on demand resources for react native app

I am trying to figure out a way to update one of the static files in my react native project.
The requirement being after client downloads the app, we can either update the app using code-push (I just want to update some static files).
Or maybe create some resource pack kind of thing, so that when user clicks on download/update resource, the file gets downloaded or updated.
So, how do I create this resource pack thing, whose content are being used in the app, consider I want to update an logo. So, downloading it, and then using that image instead of the old one.
Or any other alternatives are welcome.

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

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.