Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android notification permission issue fix #114

Merged
merged 5 commits into from
Oct 16, 2024

Conversation

meKushdeepSingh
Copy link
Collaborator

On the latest Android devices, the app will request permission to send notifications, as this setting is disabled by default.

Copy link

github-actions bot commented Oct 7, 2024

In the AndroidManifest.xml file:

  1. Remove 'android.' prefix in each of the elements. It should be like: android:name="android.permission.INTERNET" -> android:name="android.permission.INTERNET".
  2. Correct the syntax for specifying permissions. For example: android:foregroundServiceType="camera|microphone" should be android:foregroundServiceType="camera|microphone".
  3. Move the and tags outside of the tag and enclose them within an tag.
  4. Add a closing tag before the tag.

For the PushNotifyScreen.tsx file:

  1. Import 'OnboardingWrapper' from the correct path. Update the import statement from 'src/components/misc/OnboardingWrapper' to 'src/components/onboarding/OnboardingWrapper'.
  2. Fix the missing closing brackets and functions:
    • Add a closing bracket '}' for the 'const enableNotifications' function.
    • Add a closing bracket '}' for the 'const loadNextScreen' function.
    • Add a closing bracket '}' for the 'const showToast' function.
  3. Add a closing bracket '}' for the 'PushNotifyScreen' functional component.
  4. Correct the permission name in the PermissionsAndroid.request() call. Change 'POST_NOTIFICATIONS' to 'POST_NOTIFICATION'.
  5. Unify the style definition of the 'image' component. Currently, it uses '...' instead of concrete styles.
  6. Check the correct import path for 'GLOBALS' and the colors in the 'footerButtons' section.

All looks good.

Copy link

There are some mistakes identified in the provided code snippets:

  1. In the AndroidManifest.xml file, the permission names should not include "android.permission" prefix. So, the lines:

    should be corrected as:

    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
    <uses-permission android:name="android.permission.USE_FINGERPRINT"/>
    <uses-permission android:name="android.permission.VIBRATE"/>
    <uses-permission android:name="android.permission.CAMERA"/>
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.RECORD_AUDIO"/>
    <uses-permission android:name="android.permission.CHANGE_NETWORK_STATE"/>
    <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>
    <uses-permission android:name="android.permission.WAKE_LOCK"/>
  2. In the iOS Podfile.lock, the React-perflogger library seems to have a typo in the name. It should be corrected to React-PerfLogger for consistency.

  3. In the PushNotifyScreen.tsx file, the 'enableNotifications' function is missing a closing brace } before the loadNextScreen function. Also, the closing brace } for the enableNotifications function is in the wrong place.
    Also, the showToast function is missing its closing brace }.
    These should be corrected to ensure proper function syntax.

After the corrections are made, please review the code again for any other issues. Let me know if you need further assistance.

Copy link

There are a couple of issues in the provided code:

  1. In the Android manifest file:
  • The <manifest> tag should not have any extra line or content after the closing </manifest> tag. The line </manifest>import messaging from '@react-native-firebase/messaging'; should be removed from the manifest file.
  • The <uses-permission> tags should not have android prefix in the permission names. They should be like android.permission.INTERNET instead of android:permission.INTERNET, and so on.
  • The <intent> tags should be wrapped inside <queries> tag.
  1. In the React Native component:
  • There is a missing import statement for React in React from 'react';, it should be import React from 'react';.
  • The import for GLOBAL is invalid. It should be corrected to import GLOBALS instead of GLOBAL.
  • In the PermissionsAndroid.request, the permission should be PermissionsAndroid.PERMISSIONS.POST_NOTIFICATION as POST_NOTIFICATIONS is incorrect.
  • In the requestPermission function, the condition to check for messaging.AuthorizationStatus.AUTHORIZED should use strict comparison ===.

After fixing the above issues, the code looks good.

Let me know in case you need further assistance.

@rohitmalhotra1420 rohitmalhotra1420 merged commit b2c7517 into main Oct 16, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Notifications permission not working on push mobile app
2 participants