I'm having a serious issue using Expo Notifications on SDK 38.0.0. My notification icon does not appear on Android either IOS like this: https://imgur.com/a/6y32HnO. When I remove the flag: "useNextNotificationsApi": true from app.json, my icon appears on Android but, the listener to receive the notification doesn't work anymore. My listener is:
const notificationListener = useRef<Subscription>();
notificationListener.current = Notifications.addNotificationReceivedListener(notification => {
// setNotification(notification);
console.log(TAG,'::addNotificationReceivedListener:',notification)
notification.request.content.
});
I'm using react-native with Typescript, and expo SDK 38.0.0, react-native: 0.62.2
expo-notifications:"^0.5.0",
Related
Issue Description
I installed the library via npx react-native link react-native-navigation (and modifying the minSdkVersion in andoid/build.gradle).
When I run npx react-native run-android, the app is built and works fine, though I get the following error in the terminal:
error React Native CLI uses autolinking for native dependencies, but the following modules are linked manually:
- react-native-navigation (to unlink run: "react-native unlink react-native-navigation")
Since the lib has been linked manually, I add an entry in the react-native.config.js file to prevent react native to try to autolink the lib, as in:
module.exports = {
dependencies: {
'react-native-navigation': {
platforms: {
android: null, // disable Android platform, other platforms will still autolink if provided
},
}
}
};
Now, the CLI error is not longer shown and the app is successfully built, but I get an error in the emulator:
TypeError: null is not an object (evaluating "this.nativeCommandsModule.setRoot()").
Which comes about at my first Navigation.setRoot(...); call:
[index.js]
const start = () => {
Navigation.events().registerAppLaunchedListener(() => {
registerScreens();
gotoInitialising();
// gotoLogin();
});
};
start();
My question is, what extra step should I take to get the lib to work and to not have a React Native CLI error, at the same time.
Environment
React Native Navigation version: 6.0.1
React Native version: 0.61.5
Platform(s) (iOS, Android, or both?): Android
Device info (Simulator/Device? OS version? Debug/Release?): Android emulator API 28 - (emulator version 29.2.1-5889189) - Debug build
FYI, since react-native-navigation#6.1.0, the link script has been fixed to update the minSDK for android as well.
Also you should not add react-native-navigation in react-native.config.js as the RNN library is required to be used in your native code. The team has updated the documentation to make the installation guide clearer: https://wix.github.io/react-native-navigation/docs/installing. If you follow the guide, it should be quite straightforward.
run the following command: react-native unlink react-native-navigation
I am using firebase notification module in my react-native application. It works perfectly in emulator but when I install the app in mobile, onNotificationOpened event listener never gets called when I open the notification. what am i missing ?
Environment
Development Operating System: Windows
Build Tools:
React Native version: 0.60.5
React Native Firebase Version: 5.5.6
Firebase Module: notifications
Code Snippet:
this.notificationOpenedListener = firebase.notifications().onNotificationOpened((notificationOpen) => {
Linking.openURL('https://www.google.com/');
});
/*
* If your app is closed, you can check if it was opened by a notification being clicked / tapped / opened as follows:
* */
const notificationOpen = await firebase.notifications().getInitialNotification();
if (notificationOpen) {
Linking.openURL('https://www.google.com/');
}
i'm trying to implement Code-Push from AppCenter into my Ionic v4 App. (ref)
I'm stuck on the following Problem: I can update the App, but when i close the App after that and open again it is the old Version again and it says:
Updade ignored, because it was rollbacked
So somehow the update is rolled back after i close the App. After searching for this problem i found that i have to run
this.codePush.notifyApplicationReady()
on application start. I added this to my code, but it doesn't work either. If i run the Application on a Android Emulator and open the Logs, AFTER the Update it says:
cordova_not_available
So it makes sense that the notifyApplicationReady doesn't work, but why is cordova unavailable?
initializeApp() {
this.platform.ready().then(() => {
this.statusBar.styleDefault();
this.codePush.notifyApplicationReady().then(value => {
console.log(value);
});
this.codePush.sync({
deploymentKey: 'MY_KEY',
installMode: InstallMode.IMMEDIATE
}).subscribe(status => {
console.log(status);
});
this.splashScreen.hide();
});
}
Do u use command ionic build --prod ? this conmand will not include cordova.js,so if app installed this package the cordova will not available, in ionic4 i use ionic cordova build android --prod to include the cordova.js and then release the www file to code push serve.it wokrs!
I am using create-react-native-app. I want to use react-native-vector-icons
But its not showing anything on android screen (I am viewing it on expo app)
Here is what I did:
App.js:
const Courses = TabNavigator({
ReactCourses: { screen: ReactCourses },
NativeCourses: { screen: NativeCourses },
}, {
tabBarOptions: {
activeTintColor: '#e91e63',
swipeEnabled: true,
showIcon:true,
},
});
ReactCourses.js:
import Icon from 'react-native-vector-icons/MaterialIcons';
static navigationOptions = {
tabBarLabel: 'React Courses',
tabBarIcon:({ tintColor }) => (
<Icon
name={'home'}
size={26}
style={[styles.icon, {color: tintColor}]} />
)
}
Add the following things in android/app/build.gradle
apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"
And then execute the command
react-native run-android
When using Create React Native App, it's not possible to use react-native link with native module packages. Because CRNA projects are loaded in the Expo client app, you'll want to follow the relevant documentation to get vector icons working in your project.
Also, make sure that you're using the Expo preset in .babelrc. It should look like the one provided in the template project.
I think what you did is just a half thing, so after running npm install did you link the project with the third party's native code by running react-native link? if yes, did you rebuild the project by going to android studio and hit play button?if yes then just restart your packager and we are good to go...
Cheers :)
The navigator.notification.prompt is not working on android v2.3.3 (tested on motorola droid2 global). The code runs without throwing an error, but the prompt does not appear on the screen. The same app code runs fine on v4.1.2 (tested on samsung sch-1200). Any thoughts what could be preventing the prompt under v2.3.3?
I have checked cordova.apache.org docs and there is no mention of being version specific. I've also tried the other notification methods without luck.
Here is my code:
console.log('before notification prompt');
try {
navigator.notification.prompt(
'Enter the new Category', // message
onNewCategory, // callback
'Categories', // title
['Save', 'Cancel'], // buttons
'' // default text
);
}
catch (e) {
console.error(e.message);
}
console.log('after notification prompt');
The console output shows that it ran normally with no error.
'Cordova plugin ls' shows the plugin is successfully installed.
Thanks for your help.
This noted issue with the dialogs plugin has now been fixed and merged on to the dialogs repository. Hopefully this should be available in the next release of the plugin.
A possible workaround until this is released would be to replace the contents of Notification.java in platforms\android\src\org\apache\cordova\dialogs\ with this commit contents.