Add push notifications to react native application - react-native

I have an issue when i try to add push notifications to my app.
when i see the documentation: documentation , it tells me to add some code to android/build.gradle, android/app/src/main/AndroidManifest.xml and others which i don't have in my application .
I am using Expo so i don't have a folder for android and another for Ios

You are currently using Expo managed workflow. You can read more about it here.
https://docs.expo.io/introduction/managed-vs-bare/
But that is why you cannot find those files you are looking for.
To help with your issue, I did find this,
https://docs.expo.io/push-notifications/overview/
I tested the snack and it works. So you will have to figure out your trigger for the notification.
However I am not sure if you will be able to send the notification when the app is closed, so you will have to figure that out if needed.

Related

Easiest way to implement push notification in react native

I'm new to react native, how can I create simple push notifications in react native that I can trigger with buttons (or events like websocket message) like the notifications in android studio (with title,small icon, message...) , I've seen some tutorials that I tried but don't work.
Use the package named react-native-push-notification
Package Link
The installation steps are quite easy. Please use the GitHub repo for getting the steps
Github Repo

How to connect to an SSID from an app built with Expo and React Native?

I want my app to be able to connect to a Wifi network whose SSID and password are already gonna be hardcoded in the app. Hope there is a way to do this in expo. I know I could use something like https://www.npmjs.com/package/react-native-wifi-reborn but probably do not want to eject out of expo.
Answering my own question here for anyone who's facing the same problem.
With the latest Expo updates now we can add react-native packages to the managed expo workflow without ever ejecting. What that means is we can install https://www.npmjs.com/package/react-native-wifi-reborn to our Expo project.
We'll just be needing to install expo-dev-client to our project and then use EAS build. Consider reading this guide to follow the exact steps needed https://docs.expo.dev/development/getting-started/
Here is a little blog post I wrote discussing about the same.
https://blog.chiragsrvstv.dev/install-native-modules-with-expo

How can I share a file using react-native and expo on android without detaching?

I'm working on an app with Expo and would like the user be able to share a file (.vcf) with an application of their choice.
On iOS I have this working without issues using the default
Share.share({url: filetoshare})
However, the URL field only works for iOS. I read a suggestion to use
IntentLauncherAndroid.startActivityAsync('android.intent.action.SEND', {URI
: uri});
But this gives me the error:
No Activity Found To Handle Intent
Is there any way that I would be able to share a file without detaching on an android device?
If there is any additional information I could provide to make answering this question easier, please let me know. Thank you!

ReactNative: Does `Linking.addEventListener` fire when the app is running background?(Deep linking)

When I set up like this
https://facebook.github.io/react-native/docs/linking#basic-usage
and open the app via Custom URL Scheme,
_handleOpenURL catches the URL if the app is shutdown, but doesn't if the app is running background.(iOS)
So can't I use the Linking.addEventListener when the app is already running?
I was having this issue working on a detached Expo project because I had added the suggested code from https://facebook.github.io/react-native/docs/linking.html to the *AppDelegate.m but Expo already provides slightly different functions for handling URL events. Removing the code from the React Native docs made it work for me.

change image in push notification popup

I have developed the push notification functionality in my MobileFirst 7.1 app. Push notifications are working fine and I am able to receive them in my application. I want to change the image in the notification popup which is coming default as worklight image. See below screenshot. How can I do it?
In your Android project's "res/drawable*" folders ,you should find "push.png" file that shows this icon. If you change it to your own icon, make sure you maintain the same name.
Realizing that you have already accepted an answer, I'll leave this here just in case someone else has the same problem.
I found that I had to run cordova clean before my build in order for the images to get copied into the .apk properly by the build process.