question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

RNPushNotification.requestPermissions got 1 arguments, expected 0

See original GitHub issue

Bug

Hello there. I’ve just updated from 3.1.9 to 3.3.0 and started to get this message: Message occurs right after PushNotification.configure which runs on my main screen (after login)

2020-04-29 11:03:06.684 14016-14152/com.uniotecnologia.vippa E/unknown:ReactNative: Exception in native call
    com.facebook.react.bridge.NativeArgumentsParseException: RNPushNotification.requestPermissions got 1 arguments, expected 0
        at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:349)
        at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:151)
        at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
        at android.os.Handler.handleCallback(Handler.java:789)
        at android.os.Handler.dispatchMessage(Handler.java:98)
        at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:27)
        at android.os.Looper.loop(Looper.java:164)
        at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:226)
        at java.lang.Thread.run(Thread.java:764)

Environment info

react-native info output:

System:
    OS: Windows 10 10.0.18363
    CPU: (8) x64 Intel(R) Core(TM) i7-4700MQ CPU @ 2.40GHz
    Memory: 615.31 MB / 7.92 GB
  Binaries:
    Node: 12.16.1 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.4 - C:\Users\pedrorissato\AppData\Roaming\npm\yarn.CMD
    npm: 6.13.4 - C:\Program Files\nodejs\npm.CMD
    Watchman: 4.9.4 - C:\opt\watchman\bin\watchman.EXE
  SDKs:
    Android SDK: Not Found
  IDEs:
    Android Studio: Version  3.6.0.0 AI-192.7142.36.36.6241897
  Languages:
    Java: Not Found
    Python: 2.7.17
  npmPackages:
    @react-native-community/cli: Not Found
    react: 16.11.0 => 16.11.0
    react-native: 0.62.2 => 0.62.2
  npmGlobalPackages:
    *react-native*: Not Found

Library version: 3.3.0

Steps To Reproduce

  1. Upgrade react-native-push-notification in packages.json from 3.1.9 to 3.3.0
  2. Removed from AndroidManifest.xml
<service android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationRegistrationService"/>

Reproducible sample code

AndroidManifes.xml

	<meta-data android:name="com.dieam.reactnativepushnotification.notification_channel_name" android:value="Vippa Notification Channel" />
		<meta-data android:name="com.dieam.reactnativepushnotification.notification_channel_description" android:value="vippa_01" />
		<meta-data android:name="com.dieam.reactnativepushnotification.notification_color" android:resource="@android:color/white" />
		<receiver android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationPublisher" />
        <receiver android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationBootEventReceiver">
            <intent-filter>
                <action android:name="android.intent.action.BOOT_COMPLETED" />
            </intent-filter>
        </receiver>
        <service
            android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationListenerService"
            android:exported="false" >
            <intent-filter>
                <action android:name="com.google.firebase.MESSAGING_EVENT" />
            </intent-filter>
        </service>

MainApplication.java

public class MainApplication extends MultiDexApplication implements ReactApplication {

  private final ReactNativeHost mReactNativeHost =
      new ReactNativeHost(this) {
        @Override
        public boolean getUseDeveloperSupport() {
          return BuildConfig.DEBUG;
        }

        @Override
        protected List<ReactPackage> getPackages() {
          @SuppressWarnings("UnnecessaryLocalVariable")

          List<ReactPackage> packages = new PackageList(this).getPackages();

          packages.add(new RNFirebaseNotificationsPackage());
          packages.add(new RNFirebaseMessagingPackage());
          packages.add(new LottiePackage());

          return packages;
        }

        @Override
        protected String getJSMainModuleName() {
          return "index";
        }
      };

React Native configuration:

PushNotification.configure({
      onNotification(notification) {
           <BUSSINESS LOGIC>
        }
        notification.finish('backgroundFetchResultNoData');
      },
      senderID: '<ID>',
      permissions: { alert: true, badge: true, sound: true },
      popInitialNotification: true,
      requestPermissions: true,
    });

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9

github_iconTop GitHub Comments

0reactions
chax007commented, Jul 22, 2021

Can you test this: #1167 (comment)

but we aren’t getting the token value from onRegister() function.

Read more comments on GitHub >

github_iconTop Results From Across the Web

RNPushNotification.requestPermissions got 1 arguments ...
Hi, with react-native-push-notification version 3.3.1 react-native version 0,62,2 when set PushNotification.configure({ .
Read more >
Error with push notifications from react-native - Stack Overflow
rnpushnotification.requestpermissions got 1 arguments, expected 0 **. This is part of the environment information I have:
Read more >
react-native-push-notification - npm
1 ) cancelLocalNotification. The id parameter for PushNotification.localNotification is required for this operation. The id supplied will then be ...
Read more >
Push Notification with Amplify | Sumerian school
Push notifications play an essential role in any Application. It can considerably increase the user engagement, and it might be an asked feature...
Read more >
github.com-zo0r-react-native-push-notification_-_2021-05 ...
item image #1 ... (required) Called when a remote is received or opened, ... requestPermissions() later * - if you are not using...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found