GithubHelp home page GithubHelp logo

infobip / mobile-messaging-react-native-plugin Goto Github PK

View Code? Open in Web Editor NEW
26.0 18.0 5.0 70 MB

Mobile Messaging SDK plugin for React Native projects

Java 48.88% JavaScript 20.04% Ruby 1.96% Swift 19.45% Objective-C 3.69% Shell 0.35% Starlark 0.20% Makefile 0.51% C++ 2.44% Objective-C++ 1.64% CMake 0.09% TypeScript 0.74%
ios android react-native push-notifications infobip sdk

mobile-messaging-react-native-plugin's Introduction

Mobile Messaging SDK plugin for React Native

npm

Mobile Messaging SDK is designed and developed to easily enable push notification channel in your mobile application. In almost no time of implementation you get push notification in your application and access to the features of Infobip IP Messaging Platform. The document describes library integration steps for your React Native project.

Requirements

  • node (v16.10.0 or higher)
  • ruby (2.6.10 or higher)
  • React Native (v0.70.8)

For iOS project:

  • Xcode and Command Line Tools (13.2.1)
  • CocoaPods (v1.11.3)
  • Minimum deployment target 12.4

For Android project:

  • Android Studio (Bumblebee | 2021.1.1)
  • Gradle (v7.3.3)
  • Supported API Levels: 21 (Android 5.0 - Lollipop) - 34 (Android 14.0)

Quick start guide

This guide is designed to get you up and running with Mobile Messaging SDK plugin for React Native:

  1. Make sure to setup application at Infobip portal, if you haven't already.

  2. Add MobileMessaging plugin to your project, run in terminal:

    $ npm install infobip-mobile-messaging-react-native-plugin

    TypeScript's definitions are included into npm package

  3. Configure platforms

    • iOS

      Notice

      Starting from the 6.2.0 plugin version it's not mandatory to add use_frameworks! to the Podfile, check the Migration guide if you want to get rid of it.

      1. Run pod install from /ios folder (installs Mobile Messaging native SDK)
      2. Import following header #import <MobileMessaging/MobileMessagingPluginApplicationDelegate.h> and add [MobileMessagingPluginApplicationDelegate install]; into /ios/<ProjectName>/AppDelegate.m (this is required for OS callbacks such as didRegisterForRemoteNotifications to be intercepted by native MobileMessaging SDK)
          ...
          #import <MobileMessaging/MobileMessagingPluginApplicationDelegate.h>
      
          @implementation AppDelegate
      
          - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
          {
              [MobileMessagingPluginApplicationDelegate install];
              ...
          }
          ...
      1. Configure your project to support Push Notification as described in item 2 of iOS integration quick start guide
      2. Integrate Notification Service Extension into your app in order to obtain:
        • more accurate processing of messages and delivery stats
        • support of rich notifications on the lock screen
    • Android

      1. Following paths should be provided in .bash_profile

        export ANDROID_HOME=$HOME/Library/Android/sdk
        export PATH=$PATH:$ANDROID_HOME/emulator
        export PATH=$PATH:$ANDROID_HOME/tools
        export PATH=$PATH:$ANDROID_HOME/tools/bin
        export PATH=$PATH:$ANDROID_HOME/platform-tools
      2. Add 'com.google.gms:google-services' to android/build.gradle file

        buildscript {
           ...
           dependencies {
               ...
              //GMS Gradle plugin
              classpath 'com.google.gms:google-services:4.3.10'
           }
        }

        And add apply plugin: 'com.google.gms.google-services' at the end of your android/app/build.gradle in order to apply Google Services Gradle Plugin

      3. Add a Firebase configuration file (google-services.json) as described in Firebase documentation. Check Applying Firebase configuration in MobileMessaging SDK Guide for alternatives.

      Notice (when targeting Android 13):

      Starting from Android 13, Google requires to ask user for notification permission. Follow this guide to make a permission request.

Initialization configuration

Initialize Mobile Messaging React Native plugin, provide application configuration in init method:

import { mobileMessaging } from 'infobip-mobile-messaging-react-native-plugin';

someMethod(): void {
   ...

           mobileMessaging.init(
                   {
                      applicationCode: '<your app code>',
                      ios: {
                         notificationTypes: ['alert', 'badge', 'sound'],
                      },
                   },
                   () => {
                      console.log('MobileMessaging started');
                   },
                   error => {
                      console.log('MobileMessaging error: ', error);
                   },
           );
}
expand to see TypeScript code

import { mobileMessaging } from 'infobip-mobile-messaging-react-native-plugin';

someMethod(): void {
   ...

           mobileMessaging.init(
                   {
                      applicationCode: '<your app code>',
                      ios: {
                         notificationTypes: ['alert', 'badge', 'sound'],
                      },
                   },
                   () => {
                      console.log('MobileMessaging started');
                   },
                   (error: MobileMessagingError) => {
                      console.log('MobileMessaging error: ', error);
                   },
           );
}

More details on SDK features and FAQ you can find on Wiki


NEXT STEPS: User profile


If you have any questions or suggestions, feel free to send an email to [email protected] or create an issue.

mobile-messaging-react-native-plugin's People

Contributors

alboldy-ib avatar fortesdev avatar honzajerabek avatar ikresicc avatar jakubdzubak1 avatar kas-kad avatar m9obip avatar riskpp avatar tjuric avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mobile-messaging-react-native-plugin's Issues

Unable to get App Icon on Notifications in Android

Hi,

I am unable to receive App icon on Notifications, it is just displaying the default square icon. I am sharing the code snippet and other informations for more details.

Versions :
"react-native": "0.63.3", "infobip-mobile-messaging-react-native-plugin": "^5.0.1"

I am using this code for icon in AndroidManifest.xml :

<meta-data android:name="com.google.firebase.messaging.default_notification_icon" android:resource="@drawable/notification_icon" />

I also tried in init method of Infobip in react-native :
initMobileMessaging = () => { mobileMessaging.init( { applicationCode: Config.INFOBIP_KEY, ios: { notificationTypes: ["alert", "badge", "sound"], logging: true, }, android:{ notificationIcon: 'R.drawable.notification_icon' } }, () => {}, (error) => {} ); };

Please let me know if I have done any mistakes on the above codes or do I need to add any other additional code in order to display the icon?

Crashes on Android using the plugin

Hello,

We've been receiving some reports from firebase crashlytics of crashes involving this plugin:

Fatal Exception: java.lang.RuntimeException: Unable to destroy activity {br.com.madeiramadeira/br.com.madeiramadeira.MainActivity}: java.lang.IllegalArgumentException: Receiver not registered: org.infobip.reactlibrary.mobilemessaging.ReactNativeMobileMessagingModule$6@27f7efc
       at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:4497)
       at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:4515)
       at android.app.ActivityThread.-wrap5()
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1690)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loop(Looper.java:164)
       at android.app.ActivityThread.main(ActivityThread.java:6626)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:811)

Is it something related to android's sdk?

We are currently using the 2.6.0 version of the plugin and react-native 62.2

Infobip react native sdk update Issue

Hi All,

We are facing issue related to infobip sdk update, because of that we are facing multiple issue,

Existing Version: 2.2.0
Target Version :4.1.4

Current Implementation:

We have both android sdk and react native plugin in place for info bip notification handling.

  1. Infobip there is a module created in android which handles the saving user data, login, logout and handle push notifications.
  2. React native side it takes care of deep linking and routing in our application based on the notification type.

Now problem is when i upgrade there is conflict between 5.3.6 android sdk runtime which installed along with react native plugin and android sdk for infobip 4.0.2

tried upgrading the native sdk to 5.3.6 didn't help throws unable to resolve module.

Any help or guidance will be a great help
For more info please feel free to comment
Thanks & Regards
Rohit

Cannot connect SDK to infobip server even though following all instructions

I have installed the sdk properly but cannot figure out how to connect it to infobip servers. I have been with this error for the past 2 weeks. What can I do to fix this issue?

This is the error message:

{code: 1, domain: 'com.mobile-messaging', description: 'The application instance is not registered on the …ed to be notified as the registration succeeded.'} code: 1 description: "The application instance is not registered on the server yet. The registration will be perfomed eventually. Subscribe to the notificationMMRegistrationUpdatedto be notified as the registration succeeded." domain: "com.mobile-messaging"}

Below is the code that is throwing the error.

mobileMessaging.saveUser({ externalUserId: 'randomid', emails: ['[email protected]'], phones: ['787XXXXXXX'] }, user => { // Here you can use updated user instance console.log("saved user"); }, (err) => { console.log(err); });

Here are the images of the code and the aplication in the portal.

Screen Shot 2021-12-06 at 4 57 45 PM

Screen Shot 2021-12-06 at 4 57 04 PM

Runtime exception for Android OS v12+

neact native infobip runtime crash on Android

infobip-mobile-messaging-react-native-plugin -> v6.3.3
react-native -> v0.65.1
compileSdkVersion -> 31
targetSdkVersion -> 31

Fatal Exception: java.lang.IllegalArgumentException: com.bundlex.bundlex: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.
Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles.
at android.app.PendingIntent.checkFlags(PendingIntent.java:382)
at android.app.PendingIntent.getActivitiesAsUser(PendingIntent.java:616)
at android.app.PendingIntent.getActivities(PendingIntent.java:598)
at android.app.PendingIntent.getActivities(PendingIntent.java:545)
at org.infobip.mobile.messaging.notification.BaseNotificationHandler.createTapPendingIntent(BaseNotificationHandler.java:230)
at org.infobip.mobile.messaging.notification.BaseNotificationHandler.createNotificationCompatBuilder(BaseNotificationHandler.java:117)
at org.infobip.mobile.messaging.interactive.notification.InteractiveNotificationHandler.getNotificationBuilder(InteractiveNotificationHandler.java:57)
at org.infobip.mobile.messaging.interactive.notification.InteractiveNotificationHandler.displayNotification(InteractiveNotificationHandler.java:44)
at org.infobip.mobile.messaging.cloud.MobileMessageHandler.handleMessage(MobileMessageHandler.java:72)
at org.infobip.mobile.messaging.mobileapi.messages.MessagesSynchronizer$1.after(MessagesSynchronizer.java:92)
at org.infobip.mobile.messaging.mobileapi.messages.MessagesSynchronizer$1.after(MessagesSynchronizer.java:72)
at org.infobip.mobile.messaging.mobileapi.common.MRetryableTask$1.after(MRetryableTask.java:92)
at org.infobip.mobile.messaging.mobileapi.common.MAsyncTask$2.onPostExecute(MAsyncTask.java:73)
at org.infobip.mobile.messaging.mobileapi.common.MAsyncTask$2.onPostExecute(MAsyncTask.java:43)
at android.os.AsyncTask.finish(AsyncTask.java:771)
at android.os.AsyncTask.access$900(AsyncTask.java:199)
at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:788)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:226)
at android.os.Looper.loop(Looper.java:313)
at android.app.ActivityThread.main(ActivityThread.java:8669)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135)

App presenting error: Failure com.apple.main-thread

Hello,

after implementing the plugin and releasing the app (iOS) to firebase. App started to crash on start, the following comes from crashlytics:


Crashed: com.apple.main-thread
0  MobileMessaging                0x1011c0f54 $s15MobileMessaging23InstallationDataServiceC14expireIfNeeded33_B9D8BAF53C845DE85C82AD0BD28E907BLL5error_ySo7NSErrorCSg_yAIctF + 712
1  MobileMessaging                0x1011c183c $s15MobileMessaging23InstallationDataServiceC14syncWithServeryyySo7NSErrorCSgcFAA11MMOperationCSgyKXEfu_yAGcfU0_TA + 28
2  MobileMessaging                0x1012a2e08 $s15MobileMessaging23UpdateInstanceOperationC8finishedyySaySo7NSErrorCGF + 300
3  MobileMessaging                0x101261d78 $s15MobileMessaging9OperationC6finishyySaySo7NSErrorCGF + 280
4  MobileMessaging                0x1012a2818 $s15MobileMessaging23UpdateInstanceOperationC14performRequest33_24CC6FC3AF2B41E492A2AA5799BE733CLLyyFyAA8MMResultOyAA13EmptyResponseVGcfU_ + 188
5  MobileMessaging                0x1012bada8 $s15MobileMessaging8MMResultOyAA13EmptyResponseVGIegg_AFIegn_TR + 36
6  MobileMessaging                0x1012bd008 $s15MobileMessaging17SessionManagementPAAE14performRequest7request10completionyAA0F4DataC_yAA8MMResultOyqd__GctAA13JSONDecodableRd__lFyAA4JSONVSg_So7NSErrorCSgtcfU_AA17RemoteAPIProviderC_AA13EmptyResponseVTg5Tf4nnndd_n + 332
7  MobileMessaging                0x101191134 $s15MobileMessaging32DynamicBaseUrlHTTPSessionManagerC15getDataResponse_10completionyAA07RequestI0C_yAA4JSONVSg_So7NSErrorCSgtctFyAA0iJ0Vy10Foundation0I0VGcfU_ + 2452
8  MobileMessaging                0x101192858 $s15MobileMessaging11DataRequestC8response5queue0E10Serializer17completionHandlerACXDSo012OS_dispatch_F0CSg_xyAA0C8ResponseVy16SerializedObjectQzGctAA0clG8ProtocolRzlFyycfU_yycfU_AA0clG0Vy10Foundation0C0VG_Tg5TA + 36
9  MobileMessaging                0x101173150 $sIeg_IeyB_TR + 20
10 libdispatch.dylib              0x1a5459298 _dispatch_call_block_and_release + 24
11 libdispatch.dylib              0x1a545a280 _dispatch_client_callout + 16
12 libdispatch.dylib              0x1a543c5b0 _dispatch_main_queue_callback_4CF$VARIANT$armv81 + 856
13 CoreFoundation                 0x1a57a15e0 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12
14 CoreFoundation                 0x1a579ba88 __CFRunLoopRun + 2480
15 CoreFoundation                 0x1a579aba0 CFRunLoopRunSpecific + 572
16 GraphicsServices               0x1bc503598 GSEventRunModal + 160
17 UIKitCore                      0x1a808c2f4 -[UIApplication _run] + 1052
18 UIKitCore                      0x1a8091874 UIApplicationMain + 164
19 MadeiraMadeira Staging         0x10080b360 main + 16 (main.m:16)
20 libdyld.dylib                  0x1a5479568 start + 4

When building for debug/release on xcode it worked well, but when releasing to firebase this problem started.

Error: UNDELIVERABLE_REJECTED_OPERATOR on Production App

When trying to send a push notification (by the infobip portal) to a production app, it shows the following on logs:

Undeliverable - Handset errors
Expired pushRegistrationId (code 8001)
Reason: UNDELIVERABLE_REJECTED_OPERATOR
Teste
mar 02, 15:54:40
MadeiraMadeira
Comunicação
Teste

But if i try any Sandbox (Like production) it works.

I've attached the Apple Push Services certificate to the production app (It's the right one accordingly to the tutorial). So why when using production to send push notifications, it doesnt work?

Uninstall events are not being recorded

Hello, as the title says, uninstall events are not being recorded by the sdk.

Package version:

"infobip-mobile-messaging-react-native-plugin": "8.4"

SDK Initialization on index.js:

mobileMessaging.supportedEvents.forEach(event => {
    mobileMessaging.subscribe(event, handleMobileMessagingEvent);
});

mobileMessaging.init(
    {
        applicationCode: app_settings.infobip.appCode,
        ios: { notificationTypes: ['alert', 'badge', 'sound'] },
    },
    () => {},
    error => {
        console.log('MobileMessaging error: ', error?.description);
    }
);
...
AppRegistry.registerRunnable(appName, props => {
    AppRegistry.registerComponent(appName, () => App);
    TrackPlayer.registerPlaybackService(() => Player);
    AppRegistry.runApplication(appName, props);
});

After user login:

mobileMessaging.personalize(
            {
                userIdentity: {
                    emails: [email],
                    externalUserId: id
                },
                userAttributes: {
                    firstName: first_name,
                    lastName: last_name,
                    customAttributes,
                },
                forceDepersonalize: true,
            },
            user => console.log('infobip user personalized', { user }),
            error => console.error('infobip user personalized error', { error })
);

I followed carefully all the required setup steps for Android and IOS, including the addition of the Notification Service Extension on IOS.

Expected behavior:

Users who did uninstall our App must send an "Uninstall" event to the Infobip servers.

Actual behavior:

The sdk is not sending the "Uninstall" event to the infobip servers, so, the installation on th ePerson profile in the Infobip portal stays as qualified to receive push notifications and are not being filtered when making broadcasts, resulting in terrible push notifications campaign results.

Metrics on Infobip portal of user uninstalls since our last release

image

Uninstall metrics from Firebase for the same date range

image

Every time an user installs an app update, a new installation is registered in his profile.

When an user install an App update from the store, the next time he opens the app, a new installation is registered in his "Persons" profile, so, as it shows in the picture below, the user now has 2 installations, and when i send a push notification to that user email, the infobip is sending 2 pushes, one for both installations, but the older one always throws the following error: Expired pushRegistrationId (code 8001).

How do i prevent this behavior? i don't want to register a new installation for every app update. Our user base on "Persons" module is ful of garbage installations because of this.

image

Package version:

"infobip-mobile-messaging-react-native-plugin": "8.4"

SDK Initialization on index.js:

mobileMessaging.supportedEvents.forEach(event => {
    mobileMessaging.subscribe(event, handleMobileMessagingEvent);
});

mobileMessaging.init(
    {
        applicationCode: app_settings.infobip.appCode,
        ios: { notificationTypes: ['alert', 'badge', 'sound'] },
    },
    () => {},
    error => {
        console.log('MobileMessaging error: ', error?.description);
    }
);
...
AppRegistry.registerRunnable(appName, props => {
    AppRegistry.registerComponent(appName, () => App);
    TrackPlayer.registerPlaybackService(() => Player);
    AppRegistry.runApplication(appName, props);
});

After user login:

mobileMessaging.personalize(
            {
                userIdentity: {
                    emails: [email],
                    externalUserId: id
                },
                userAttributes: {
                    firstName: first_name,
                    lastName: last_name,
                    customAttributes,
                },
                forceDepersonalize: true,
            },
            user => console.log('infobip user personalized', { user }),
            error => console.error('infobip user personalized error', { error })
);

No such module 'MobileMessaging' in the version 4.0.0

Hello, I'm currently using the 3.1.0 version and when trying to update to the latest version, I'm getting a "No such module 'MobileMessaging'".

In the 3.1.0 version I added to the FRAMEWORK_SEARCH_PATHS to following path:

$(SRCROOT)/../node_modules/infobip-mobile-messaging-react-native-plugin/ios/Carthage/Build/iOS/

But in the 4.0.0 version that path does not exist.

Best regards and waiting for your comments,
Leonardo

Push notifications not receiving

Hi,

I migrated mobile-messaging-react-native-plugin to the latest version(6.3.3) that got released recently.

   mobileMessaging.init(
           {
              applicationCode: '<your app code>',
              ios: {
                 notificationTypes: ['alert', 'badge', 'sound'],
              },
           },
           () => {
              console.log('MobileMessaging started');
           },
           error => {
              console.log('MobileMessaging error: ', error);
           },
   );

system logs

MobileMessaging started

Tested all types of push notifications on both Android and iOS but none of the Notifications are getting received in the mobile App.

React-Native :- 0.65.1
Android :- 11,12
iOS :- 14,15
mobile-messaging-react-native-plugin :- 6.3.3

Plugin installation error from react@"17.0.1"

Found: [email protected]
npm ERR! node_modules/react
npm ERR! react@"17.0.1" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^17.0.2" from [email protected]
npm ERR! node_modules/infobip-mobile-messaging-react-native-plugin
npm ERR! infobip-mobile-messaging-react-native-plugin@"^5.0.1" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.

Pods completion on Xcode15

The issue appears as like below on Operation class

Property 'completionBlock' with type '(() -> Void)?' cannot override a property with type '(@Sendable () -> Void)?'

App crash on mobile-messaging initialization

After creating the widget on the dashboard and following the infobip-mobile-messaging-react-native-plugin installation guide, the Android app fails to build with this error

Execution failed for task ':app:mergeDebugResources'.
> [string/google_app_id] /android/app/src/main/res/values/strings.xml	[string/google_app_id] /android/app/build/generated/res/google-services/debug/values/values.xml: Error: Duplicate resources

If I should remove this line of code below in /android/app/src/main/res/values/strings.xml the app builds successfully.
<string name="google_app_id">your google app id</string>

We have Firebase set up in the app with the google-services.json file.
When I get to build the app successfully for development, after initialization configuration, the app crashes,

App Killed : Notification Tapped Not Detected.

Hi All,

May i know how to detect notification tap event if app is killed.

Detail Scenario: Suppose a new notification that is right now in notification tray is tapped how to detect that and store notification data in the application state suppose redux for deep linking.

Please help us on this as we are facing this issue
infobip lib version :2.2.0

Thanks & Regards
Rohit

react native ios manual plugin issue

It builds fine in local system but fails in dev ops when built through CI, error attached. Its probably because in manual integration we use npm run mm_build and Carthage which is not there in azure. Please help how can we do this manual integration in azure.
Screenshot 2020-09-08 at 9 24 18 AM

Clash with other library - react-native-image-crop-picker

Issue

Adding react-native-image-crop-picker library along with this library causes crop picker to stop working.

After installation of the Infobip plugin we are unable to open the image picker and are faced with the following error in XCode :
[ChangeHandling] API misuse: pauseChangeHandling called when changeHandlingContainer is nil (never initialized or already invalidated).

We have followed manual installation on iOS using these steps


Project Files

Javascript

Click To Expand

package.json:

"dependencies": {
    "infobip-mobile-messaging-react-native-plugin": "^6.0.0",
    "react": "17.0.2",
    "react-native": "0.68.2",
    "react-native-image-crop-picker": "^0.37.3"
  }

iOS

Click To Expand

ios/Podfile:

  • I'm not using Pods
  • I'm using Pods and my Podfile looks like:
require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

platform :ios, '11.0'

target 'Example' do
  config = use_native_modules!
  use_react_native!(
    :path => config[:reactNativePath],
    # to enable hermes on iOS, change `false` to `true` and then install pods
    :hermes_enabled => true
  )
  
  post_integrate do |installer|
    project = Xcodeproj::Project.open("Example.xcodeproj")
    project.targets.each do |target|
      script_need_to_be_removed = '[CP] Check Pods Manifest.lock'
      phase = target.shell_script_build_phases.select { |phase| phase.name.include?(script_need_to_be_removed) }.first
      unless phase.nil?
        target.build_phases.delete(phase)
        puts "script #{script_need_to_be_removed} removed"
      end
    end
    project.save()
  end

  # Enables Flipper.
  #
  # Note that if you have use_frameworks! enabled, Flipper will not work and
  # you should disable the next line.
  use_flipper!()

  post_install do |installer|
    installer.pods_project.targets.each do |target|
        target.build_configurations.each do |config|
          config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64 i386"
       end
       end
    react_native_post_install(installer)
    __apply_Xcode_12_5_M1_post_install_workaround(installer)
  end
end

AppDelegate.m:

#import "AppDelegate.h"

#import <React/RCTBridge.h>
#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>
#import "RNSplashScreen.h"
#import <Firebase.h>
#import <MobileMessaging/MobileMessagingPluginApplicationDelegate.h>

#ifdef FB_SONARKIT_ENABLED
#import <FlipperKit/FlipperClient.h>
#import <FlipperKitLayoutPlugin/FlipperKitLayoutPlugin.h>
#import <FlipperKitUserDefaultsPlugin/FKUserDefaultsPlugin.h>
#import <FlipperKitNetworkPlugin/FlipperKitNetworkPlugin.h>
#import <SKIOSNetworkPlugin/SKIOSNetworkAdapter.h>
#import <FlipperKitReactPlugin/FlipperKitReactPlugin.h>

static void InitializeFlipper(UIApplication *application) {
  FlipperClient *client = [FlipperClient sharedClient];
  SKDescriptorMapper *layoutDescriptorMapper = [[SKDescriptorMapper alloc] initWithDefaults];
  [client addPlugin:[[FlipperKitLayoutPlugin alloc] initWithRootNode:application withDescriptorMapper:layoutDescriptorMapper]];
  [client addPlugin:[[FKUserDefaultsPlugin alloc] initWithSuiteName:nil]];
  [client addPlugin:[FlipperKitReactPlugin new]];
  [client addPlugin:[[FlipperKitNetworkPlugin alloc] initWithNetworkAdapter:[SKIOSNetworkAdapter new]]];
  [client start];
}
#endif

@import MobileMessaging;

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
  [MobileMessagingPluginApplicationDelegate install];
  
  [FIRApp configure];
#ifdef FB_SONARKIT_ENABLED
  InitializeFlipper(application);
#endif

  RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
  RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge
                                                   moduleName:@"Example"
                                            initialProperties:nil];

  if (@available(iOS 13.0, *)) {
      rootView.backgroundColor = [UIColor systemBackgroundColor];
  } else {
      rootView.backgroundColor = [UIColor whiteColor];
  }

  self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
  UIViewController *rootViewController = [UIViewController new];
  rootViewController.view = rootView;
  self.window.rootViewController = rootViewController;
  [self.window makeKeyAndVisible];
  [RNSplashScreen show];
  return YES;
}

- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
{
#if DEBUG
  return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
#else
  return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
#endif
}

@end


Environment

Click To Expand

react-native info output:

System:
    OS: macOS 12.3.1
    CPU: (8) arm64 Apple M1
    Memory: 83.39 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 17.7.2 - /opt/homebrew/bin/node
    Yarn: Not Found
    npm: 8.5.2 - /opt/homebrew/bin/npm
    Watchman: 2022.03.14.00 - /opt/homebrew/bin/watchman
  Managers:
    CocoaPods: 1.11.3 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 21.2, iOS 15.2, macOS 12.1, tvOS 15.2, watchOS 8.3
    Android SDK: Not Found
  IDEs:
    Android Studio: 2021.2 AI-212.5712.43.2112.8512546
    Xcode: 13.2.1/13C100 - /usr/bin/xcodebuild
  Languages:
    Java: 11.0.11 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 17.0.2 => 17.0.2 
    react-native: 0.66.4 => 0.66.4 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found
  • Platform that you're experiencing the issue on:
    • iOS
    • Android
  • infobip/mobile-messaging-react-native-plugin version you're using that has this issue:
    • 6.0.0
  • Are you using TypeScript?
    • N

---

Will it work for RN 0.61.3 !?

Hi I just wanted to know before integrating this fantastic library that if this library works on RN 0.61.3. Since in ReadMe file, it shows React Native - 0.61.5 is the minimum requirement !?

Prompt reply can be expected. @riskpp

Android App keeps on crashing in InfoBip in the new version

Hi,

I set up infobip in react-native for Android and IOS but the app keeps on crashing in Android and I am receiving the below error message. Can someone please suggest to me if in Android we require some additional manual setup or if I have done the wrong setup?

Below are some details for your reference :

Versions :

"react-native": "0.63.3",
"infobip-mobile-messaging-react-native-plugin": "^5.0.1",
"@react-native-firebase/analytics": "^12.0.0",
"@react-native-firebase/app": "^12.0.0",
"@react-native-firebase/auth": "^12.0.0",
"@react-native-firebase/crashlytics": "^12.0.0"

In strings.xml file, I have defined :

<string name="google_app_id">"My App Id"</string>

Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.firebase.iid.FirebaseInstanceId" on path: DexPathList[[zip file "/data/app/~~LsEr1EAoWnoUpWPd8vta6w==/com.reelCinema.Screens.stage-KybA6KzW0TWuWenw4tqH-g==/base.apk"],nativeLibraryDirectories=[/data/app/~~LsEr1EAoWnoUpWPd8vta6w==/com.reelCinema.Screens.stage-KybA6KzW0TWuWenw4tqH-g==/lib/x86, /data/app/~~LsEr1EAoWnoUpWPd8vta6w==/com.reelCinema.Screens.stage-KybA6KzW0TWuWenw4tqH-g==/base.apk!/lib/x86, /system/lib, /system_ext/lib]]

Crash issue on SDK version 7.0.3 & 8.0.0

We integrated SDK Mobile Messaging SDK version 7.0.3 and getting this error: "Error: You attempted to set the key reactNativePluginVersion with the value "7.0.3" on an object that is meant to be immutable and has been frozen." According to this releases document: https://github.com/infobip/mobile-messaging-react-native-plugin/releases, looks like some crash issues on Android 12 has been resolved in SDK version 8.0.0, we remove the SDK version 7.0.3, cleaned the code and re-integrated with SDK version 8.0.0 but getting the same issue:
"Error: You attempted to set the key reactNativePluginVersion with the value "8.0.0" on an object that is meant to be immutable and has been frozen."

sdk_err_1

Anyone can help us on this?

Unable to connect to the chat. - TypeError: Cannot read property 'init' of null

Unable to connect to the chat. I get this error on initialization.

 ERROR  TypeError: Cannot read property 'init' of null, js engine: hermes

 ERROR  TypeError: Cannot read property 'messageStorage' of undefined, js engine: hermes

Here's the function call

const openChat = () => {
       mobileMessaging.init(
           {
               applicationCode: infobipCode,
               inAppChatEnabled: true,
           },
           () => {
               console.log('MobileMessaging started');
               mobileMessaging.saveUser(
                   user,
                   (error) => {
                       errorHandler(error, 35);
                   }
               );
               mobileMessaging.showChat();
           },
           (error) => {
               errorHandler(error, 35);
               console.log('MobileMessaging error: ', error);

           },
       );
   };

Runtime Crash on Android Release Build

Hi,

I am using :

"infobip-mobile-messaging-react-native-plugin": "6.1.0", "react-native": "0.63.3", "react": "16.13.1"
In Debug the application is running fine and I am able to fetch notifications. But wheneve I am creating release builds, then after opening the release app it will immediately crash and I found the error log below for that :

--------- beginning of crash 2022-06-14 13:09:20.564 11667-11748/? E/AndroidRuntime: FATAL EXCEPTION: mqt_native_modules Process: com.Screens.stage, PID: 11667 java.lang.IllegalArgumentException: Configuration is invalid at org.infobip.reactlibrary.mobilemessaging.b.a(SourceFile:3) at org.infobip.reactlibrary.mobilemessaging.ReactNativeMobileMessagingModule.init(SourceFile:1)

Can anyone help regarding the above issue?

Building issue on Xcode 12.5

Hi,

On Xcode 12.4 we just saw the warnings, but now on the new Xcode 12.5 they have become errors.I think that this should be taken care of now. Not sure how much I can just remove these attributes.

Error:

ios/Pods/MobileMessaging/Classes/Vendor/CryptoSwift/Generics.swift:39:28: 'exported: true' has no effect in '_specialize' attribute'_specialize' attribute
@_specialize(exported: true, where T == Int) 'exported: true' has no effect in '_specialize' attribute
@_specialize(exported: true, where T == UInt)'exported: true' has no effect in '_specialize' attribute
@_specialize(exported: true, where T == UInt8) 'exported: true' has no effect in '_specialize' attribute
@_specialize(exported: true, where T == UInt16) 'exported: true' has no effect in '_specialize' attribute
@_specialize(exported: true, where T == UInt32) 'exported: true' has no effect in '_specialize' attribute
@_specialize(exported: true, where T == UInt64) 'exported: true' has no effect in '_specialize' attribute
^
ios/Pods/MobileMessaging/Classes/Vendor/CryptoSwift/UInt32+Extension.swift:32:29: 'exported: true' has no effect in '_specialize' attribute
@_specialize(exported: true, where T == ArraySlice)

Versions:

MobileMessaging SDK version: 3.0.3
Xcode version: 12.5
Cocoapods version: 1.10.1

Empty screen and disabled input after chat opening

Environment:
Xcode 12.5.1
Cocoapods 1.10.1
Gradle 4.1.0
react-native 0.64.2
infobip-mobile-messaging-react-native-plugin 4.0.0

Initialization:

mobileMessaging.init(
  {
    applicationCode: Config.INFOBIP_APP_CODE,
    inAppChatEnabled: true,
    geofencingEnabled: false,
    ios: {
      notificationTypes: ['alert', 'badge', 'sound'],
      logging: true,
    },
  },
  () => {
    console.log('MobileMessaging started');
  },
  (error: any) => {
    console.log('MobileMessaging error: ', error);
  },
);

mobileMessaging.showChat(); works almost fine (first func call) on Android, but on IOS - empty state with disabled input.

iOS screenshot iOS_showChat
Android screenshot (first launch) Android_showChat_1
Android screenshot (next launch, immediately after the chat is closed) Android_showChat_2

<ChatView /> - don't work on Android (empty screen without input) and on IOS - empty state with disabled input:

iOS screenshot iOS_ChatView
Android screenshot Android_ChatView

iOS logs
2021-07-29 12:23:22:355 [MobileMessaging] 🛠 [MobileMessaging] Starting service (with apns registration=true)...
2021-07-29 12:23:22:359 [MobileMessaging] 💬 Unarchived nil from /Users/fredmd/Library/Developer/CoreSimulator/Devices/75F7D8F5-1490-4783-9ED4-4092B4940D71/data/Containers/Data/Application/7D0F7BEA-AFB7-40B3-AD70-F18137758D92/Library/Application Support/com.mobile-messaging.installation
2021-07-29 12:23:23:440 [MobileMessaging] 🛠 [MMMessageHandler] starting
2021-07-29 12:23:23:440 [MobileMessaging] 🛠 [VersionManager] started...
2021-07-29 12:23:23:441 [MobileMessaging] 🛠 [MessagesEvictionOperation] started...
2021-07-29 12:23:23:447 [MobileMessaging] 💬 [Core Data] NO CHANGES IN ** UNNAMED ** CONTEXT - NOT SAVING
2021-07-29 12:23:23:448 [MobileMessaging] 🛠 [MessagesEvictionOperation] finished with errors: []
2021-07-29 12:23:23:468 [MobileMessaging] 🛠 [DynamicBaseUrlHTTPSessionManager] Sending request: 
  -H "User-Agent: org.cocoapods.MobileMessaging/9.1.10 reactNative 4.0.0(iOS;14.5;;iPhone Simulator;;io.samokat.timelabse;0.1;iPhone 12;;;)" \
2021-07-29 12:23:23:470 [MobileMessaging] 🛠 [InstallationDataService] starting
2021-07-29 12:23:23:470 [MobileMessaging] 🛠 [UserSessionService] starts
2021-07-29 12:23:23:471 [MobileMessaging] 🛠 [ApnsRegistrationManager] Registering...
2021-07-29 12:23:23:471 [MobileMessaging] 🛠 [UserSessionService] starting
2021-07-29 12:23:23:475 [MobileMessaging] 🛠 [ApnsRegistrationManager] setting healthy flag
2021-07-29 12:23:23:481 [MobileMessaging] 🛠 [NotificationsInteractionService] starting
2021-07-29 12:23:23:482 [MobileMessaging] 🛠 [MMInAppChatService] starting
2021-07-29 12:23:23:485 [MobileMessaging] 🛠 [UserDataService] sync user data with server
2021-07-29 12:23:23:485 [MobileMessaging] 🛠 [GetChatWidgetOperation] Started...
2021-07-29 12:23:23:486 [MobileMessaging] 💬 Unarchived nil from /Users/fredmd/Library/Developer/CoreSimulator/Devices/75F7D8F5-1490-4783-9ED4-4092B4940D71/data/Containers/Data/Application/7D0F7BEA-AFB7-40B3-AD70-F18137758D92/Library/Application Support/com.mobile-messaging.user
2021-07-29 12:23:23:489 [MobileMessaging] 💬 Unarchived Optional(<MobileMessaging.MMUser: 0x600003261ef0>) from /Users/fredmd/Library/Developer/CoreSimulator/Devices/75F7D8F5-1490-4783-9ED4-4092B4940D71/data/Containers/Data/Application/7D0F7BEA-AFB7-40B3-AD70-F18137758D92/Library/Application Support/com.mobile-messaging.dirty-user
2021-07-29 12:23:23:492 [MobileMessaging] 🛠 [DynamicBaseUrlHTTPSessionManager] Sending request: 
  -H "User-Agent: org.cocoapods.MobileMessaging/9.1.10 reactNative 4.0.0(iOS;14.5;;iPhone Simulator;;io.samokat.timelabse;0.1;iPhone 12;;;)" \
2021-07-29 12:23:23:493 [MobileMessaging] 🛠 [MobileMessaging] Service started with subservices: ["MMMessageHandler": <MobileMessaging.MMMessageHandler: 0x6000023bfe30>, "NotificationsInteractionService": <MobileMessaging.NotificationsInteractionService: 0x600000f3c1e0>, "UserSessionService": <MobileMessaging.UserSessionService: 0x60000242e340>, "BaseUrlManager": <MobileMessaging.BaseUrlManager: 0x600000f3c210>, "InAppChatService": <MobileMessaging.MMInAppChatService: 0x60000376d080>, "InstallationDataService": <MobileMessaging.InstallationDataService: 0x600000f6e4f0>, "EventsService": <MobileMessaging.EventsService: 0x6000023af520>, "UserDataService": <MobileMessaging.UserDataService: 0x600000f3c240>]
2021-07-29 12:23:23:493 [MobileMessaging] ⚠️ [UpdateUserOperation] There is no registration. Finishing...
2021-07-29 12:23:23:494 [MobileMessaging] 💬 Unarchived nil from /Users/fredmd/Library/Developer/CoreSimulator/Devices/75F7D8F5-1490-4783-9ED4-4092B4940D71/data/Containers/Data/Application/7D0F7BEA-AFB7-40B3-AD70-F18137758D92/Library/Application Support/com.mobile-messaging.dirty-installation
2021-07-29 12:23:23:495 [MobileMessaging] 🛠 [UpdateUserOperation] finished with errors: [Error Domain=com.mobile-messaging Code=1 "The application instance is not registered on the server yet. The registration will be perfomed eventually. Subscribe to the notification `MMRegistrationUpdated` to be notified as the registration succeeded." UserInfo={NSLocalizedDescription=The application instance is not registered on the server yet. The registration will be perfomed eventually. Subscribe to the notification `MMRegistrationUpdated` to be notified as the registration succeeded.}]
2021-07-29 12:23:23:495 [MobileMessaging] 🛠 [MobileMessaging] Retrying sending mobile originated messages...
2021-07-29 12:23:23:496 [MobileMessaging] 🛠 [LocalMessageFetchingOperation] Retrieved 0 messages from notification extension storage.
2021-07-29 12:23:23:497 [MobileMessaging] 🛠 [MessagePostingOperation] started...
2021-07-29 12:23:23:498 [MobileMessaging] 🛠 [InstallationDataService] sync installation data with server...
2021-07-29 12:23:23:498 [MobileMessaging] ⚠️ [MessagePostingOperation] No registration. Finishing...
2021-07-29 12:23:23:498 [MobileMessaging] 🛠 [MessagePostingOperation] finished with errors: [Error Domain=com.mobile-messaging Code=1 "The application instance is not registered on the server yet. The registration will be perfomed eventually. Subscribe to the notification `MMRegistrationUpdated` to be notified as the registration succeeded." UserInfo={NSLocalizedDescription=The application instance is not registered on the server yet. The registration will be perfomed eventually. Subscribe to the notification `MMRegistrationUpdated` to be notified as the registration succeeded.}]
2021-07-29 12:23:23:498 [MobileMessaging] 🛠 [LocalMessageFetchingOperation] Retrieved 0 messages from notification center.
2021-07-29 12:23:23:498 [MobileMessaging] 🛠 [LocalMessageFetchingOperation] finished with errors: []
2021-07-29 12:23:23:505 [MobileMessaging] 🛠 [SeenStatusSendingOperation] There is no non-seen meessages to send to the server. Finishing...
2021-07-29 12:23:23:505 [MobileMessaging] 🛠 [SeenStatusSendingOperation] finished: []
2021-07-29 12:23:23:506 [MobileMessaging] 🛠 [MessageFetchingOperation] Starting operation...
2021-07-29 12:23:23:506 [MobileMessaging] ⚠️ [MessageFetchingOperation] No registration. Finishing...
2021-07-29 12:23:23:506 [MobileMessaging] 🛠 [MessageFetchingOperation] finished with errors: []
2021-07-29 12:23:23:507 [MobileMessaging] 🛠 [MessagesSyncOperation] finished with errors: []
2021-07-29 12:23:23:512 [MobileMessaging] ⚠️ [UpdateInstanceOperation] There is no reference registration. Aborting...
2021-07-29 12:23:23:518 [MobileMessaging] ⚠️ [CreateInstanceOperation] There is no registration data to send. Aborting...
2021-07-29 12:23:23:518 [MobileMessaging] 🛠 [UserDataService] sync user data with server
2021-07-29 12:23:23:519 [MobileMessaging] ⚠️ [UpdateUserOperation] There is no registration. Finishing...
2021-07-29 12:23:23:520 [MobileMessaging] 🛠 [UpdateUserOperation] finished with errors: [Error Domain=com.mobile-messaging Code=1 "The application instance is not registered on the server yet. The registration will be perfomed eventually. Subscribe to the notification `MMRegistrationUpdated` to be notified as the registration succeeded." UserInfo={NSLocalizedDescription=The application instance is not registered on the server yet. The registration will be perfomed eventually. Subscribe to the notification `MMRegistrationUpdated` to be notified as the registration succeeded.}]
2021-07-29 12:23:23:836 [MobileMessaging] 🛠 [DynamicBaseUrlHTTPSessionManager] Response received
2021-07-29 12:23:23:839 [MobileMessaging] ‼️ [VersionManager] An error occurred while trying to validate library version: MobileMessaging.AFError.responseValidationFailed(reason: MobileMessaging.AFError.ResponseValidationFailureReason.unacceptableStatusCode(code: 403))
2021-07-29 12:23:23:950 [MobileMessaging] 🛠 [DynamicBaseUrlHTTPSessionManager] Response received
2021-07-29 12:23:23:952 [MobileMessaging] 🛠 [GetChatWidgetOperation] finished with errors: []
2021-07-29 12:23:23:956 [MobileMessaging] 🛠 [GetChatWidgetOperation] Started...
2021-07-29 12:23:23:977 [MobileMessaging] 🛠 [DynamicBaseUrlHTTPSessionManager] Sending request: 
  -H "User-Agent: org.cocoapods.MobileMessaging/9.1.10 reactNative 4.0.0(iOS;14.5;;iPhone Simulator;;io.samokat.timelabse;0.1;iPhone 12;;;)" \
2021-07-29 12:23:24:048 [MobileMessaging] 🛠 [DynamicBaseUrlHTTPSessionManager] Response received
2021-07-29 12:23:24:048 [MobileMessaging] 🛠 [GetChatWidgetOperation] finished with errors: []
2021-07-29 12:23:28:471 [MobileMessaging] 🛠 [UserSessionService] no push registration id. Aborting...
2021-07-29 12:23:33:471 [MobileMessaging] 🛠 [UserSessionService] no push registration id. Aborting...
2021-07-29 12:23:33:927 [MobileMessaging] 🛠 [UserDataService] saving ["middleName": Optional("Иванович"), "emails": nil, "installations": nil, "birthday": nil, "gender": nil, "customAttributes": nil, "externalUserId": Optional("557bedca-2c2c-4624-9b5a-6a7f47e0fd6a"), "firstName": Optional("Фёдор"), "tags": nil, "phones": Optional(["+7 373 000-00-04"]), "lastName": Optional("Морозов")]
2021-07-29 12:23:33:927 [MobileMessaging] 💬 Archiving <MobileMessaging.MMUser: 0x6000032283f0> at /Users/fredmd/Library/Developer/CoreSimulator/Devices/75F7D8F5-1490-4783-9ED4-4092B4940D71/data/Containers/Data/Application/7D0F7BEA-AFB7-40B3-AD70-F18137758D92/Library/Application Support/com.mobile-messaging.dirty-user
2021-07-29 12:23:33:928 [MobileMessaging] 🛠 [UserDataService] sync user data with server
2021-07-29 12:23:33:929 [MobileMessaging] ⚠️ [UpdateUserOperation] There is no registration. Finishing...
2021-07-29 12:23:33:930 [MobileMessaging] 🛠 [UpdateUserOperation] finished with errors: [Error Domain=com.mobile-messaging Code=1 "The application instance is not registered on the server yet. The registration will be perfomed eventually. Subscribe to the notification `MMRegistrationUpdated` to be notified as the registration succeeded." UserInfo={NSLocalizedDescription=The application instance is not registered on the server yet. The registration will be perfomed eventually. Subscribe to the notification `MMRegistrationUpdated` to be notified as the registration succeeded.}]
2021-07-29 12:23:38:471 [MobileMessaging] 🛠 [UserSessionService] no push registration id. Aborting...

What am I doing wrong or missing?

Linking failed with React Native. infobip-mobile-messaging-react-native-plugin.podspec file is not installing

Hi,

We are trying to integrate this Plugin to the React Native project. but always throwing the attached exception. Below code to initialize push notification with application code.

const { ReactNativeMobileMessaging } = NativeModules;

    ReactNativeMobileMessaging.init("3c59f6e341a6896fc05b8cd7e3f3fdf8-031a75db-fd8f-46b0-9f2b-a2e915d7b952_");
     

Can you please share the POC/Example for React Native app?
And also, Let's know how to link with React Native.

Thanks,
Simulator Screen Shot - iPhone 11 - 2020-02-20 at 14 15 06

Crashes on Android

Hello,

We've been receiving some reports from firebase crashlytics of crashes involving this plugin:
Fatal Exception: java.lang.NullPointerException
Attempt to get length of null array
org.infobip.reactlibrary.mobilemessaging.ReactNativeEvent.send

Fatal Exception: java.lang.NullPointerException: Attempt to get length of null array
       at org.infobip.reactlibrary.mobilemessaging.ReactNativeEvent.send(ReactNativeEvent.java:28)
       at org.infobip.reactlibrary.mobilemessaging.ReactNativeMobileMessagingModule.initialize(ReactNativeMobileMessagingModule.java:71)
       at com.facebook.react.bridge.ModuleHolder.doInitialize(ModuleHolder.java:236)
       at com.facebook.react.bridge.ModuleHolder.markInitializable(ModuleHolder.java:100)
       at com.facebook.react.bridge.NativeModuleRegistry.notifyJSInstanceInitialized(NativeModuleRegistry.java:129)
       at com.facebook.react.bridge.CatalystInstanceImpl$2.run(CatalystInstanceImpl.java:443)
       at android.os.Handler.handleCallback(Handler.java:914)
       at android.os.Handler.dispatchMessage(Handler.java:100)
       at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:27)
       at android.os.Looper.loop(Looper.java:225)
       at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:226)
       at java.lang.Thread.run(Thread.java:919)

Setup:
React Native: 0.66.3
mobile-messaging-react-native-plugin: 4.1.4

Could you assist me in how I can resolve this?

(Manual plugin Integration) Native module cannot be null

When using the manual plugin integration for iOS i get this error importing:
import { mobileMessaging } from 'infobip-mobile-messaging-react-native-plugin';

And trying to set mobileMessaging.init()

MobileMessaging.frameworks is already on frameworks, libraries, etc and Link Binary with Libraries

Runtime Crash on Android Prod Releases

Hello there!
We are getting the following error about 30 times a day, according to Firebase Crashlytics in our project:

Fatal Exception: java.lang.RuntimeException
Unable to destroy activity {br.com.madeiramadeira/br.com.madeiramadeira.MainActivity}: java.lang.IllegalArgumentException: Receiver not registered: org.infobip.reactlibrary.mobilemessaging.ReactNativeMobileMessagingModule$5@f769ba4
android.app.ActivityThread.performDestroyActivity (ActivityThread.java:4969)
android.app.ActivityThread.handleDestroyActivity (ActivityThread.java:4998)
android.app.servertransaction.DestroyActivityItem.execute (DestroyActivityItem.java:44)
android.app.servertransaction.TransactionExecutor.executeLifecycleState (TransactionExecutor.java:176)
android.app.servertransaction.TransactionExecutor.execute (TransactionExecutor.java:97)
android.app.ActivityThread$H.handleMessage (ActivityThread.java:2041)
android.os.Handler.dispatchMessage (Handler.java:107)
android.os.Looper.loop (Looper.java:214)
android.app.ActivityThread.main (ActivityThread.java:7386)
java.lang.reflect.Method.invoke (Method.java)
com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:492)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:980)

And the cause is supposedly at:

org.infobip.reactlibrary.mobilemessaging.ReactNativeMobileMessagingModule.unregisterBroadcastReceiver (ReactNativeMobileMessagingModule.java:411)

At the starting of the app we are calling mobileMessaging.register, and as a callback on unmounting the app, we're calling mobileMessaging.unregister, where i believe the problem is occurring, but it does not make sense since the register did ok. Tho i might be wrong in this diagnosis, i did not found anything useful regarding this problem in the wiki or documentation.

We are using version 6.0.0 of infobip-mobile-messaging-react-native-plugin, react-native 0.66.3, react 17.0.2.

We are getting app code to the sdk according to past issue here, and also as the past problems, various devices, from samsung, motorola, to xiaomi, in Android 8 and below, 9, 10 and 11.

Since now, thanks for the attention.

Module 'MobileMessaging' not found

Hello Team, I have installed mobile-messaging-react-native-plugin on the app and followed the instructions mentioned on Readme file, however it is throwing Module 'MobileMessaging' not found error even after doing pod install after npm installation. Hope someone can help in integration to iOS. @riskpp @tjuric

TypeError: Cannot read property 'deleteAll' of undefined

Below code results in a promise rejection with the error TypeError: Cannot read property 'deleteAll' of undefined

import { mobileMessaging } from 'infobip-mobile-messaging-react-native-plugin';
mobileMessaging.defaultMessageStorage().deleteAll(() => {
       console.log('Deleted all messages');
 });

We suddenly stopped receiving notifications on our iOS devices

Hi team,

A month ago, we received notifications on our iOS devices, but now the Infobip service is not working on the mentioned platform. I checked that those devices had a pushRegistrationId, and when we searched for those IDs in the Infobip database (by logging in https://portal.infobip.com/login/) and I couldn’t find those IDs. I also waited for several hours in order to check if there was some kind of delay in the database, but that was not the case. On the other hand, some iOS users are receiving some notifications but not all of them. An example of this is an iOS developer that we have in the team that has a pushRegistrationId that, according to Infobip, says that the last contact was ‘Never’. In this case, for example, is a person with an iPhone that works with it 50 hours per week with the App installed and working.

How can this be fixed?

Best regards and waiting for your comments.
Thanks!

Error: Building MobileMessaging.framework with Carthage

Hello team,

I've got some errors when building MobileMessaging.framework.

I upgraded Xcode and when I run npm run mm_build in node_modules/infobip-mobile-messaging-react-native-plugin.
I could see the following error in the terminal:

Building MobileMessaging.framework with Carthage started...
*** Checking out mobile-messaging-sdk-ios at "9.0.1"
*** No cache found for mobile-messaging-sdk-ios, building with all downstream dependencies
*** xcodebuild output can be found in /var/folders/pb/34w99wj969g1xrh0dg2mhs0c0000gn/T/carthage-xcodebuild.SdnK2h.log
*** Building scheme "MobileMessaging" in MobileMessaging.xcodeproj
Build Failed
	Task failed with exit code 65:
	/usr/bin/xcrun xcodebuild -project /Users/phvillegas/app/node_modules/infobip-mobile-messaging-react-native-plugin/ios/Carthage/Checkouts/mobile-messaging-sdk-ios/MobileMessaging.xcodeproj -scheme MobileMessaging -configuration Release -derivedDataPath /Users/phvillegas/Library/Caches/org.carthage.CarthageKit/DerivedData/12.5_12E262/mobile-messaging-sdk-ios/9.0.1 -sdk iphoneos ONLY_ACTIVE_ARCH=NO CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= CARTHAGE=YES archive VALIDATE_WORKSPACE=NO -archivePath /var/folders/pb/34w99wj969g1xrh0dg2mhs0c0000gn/T/mobile-messaging-sdk-ios SKIP_INSTALL=YES GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=NO CLANG_ENABLE_CODE_COVERAGE=NO STRIP_INSTALLED_PRODUCT=NO (launched in /Users/phvillegas/app/node_modules/infobip-mobile-messaging-react-native-plugin/ios/Carthage/Checkouts/mobile-messaging-sdk-ios)

This usually indicates that project itself failed to compile. Please check the xcodebuild log for more details: /var/folders/pb/34w99wj969g1xrh0dg2mhs0c0000gn/T/carthage-xcodebuild.SdnK2h.log
Building MobileMessaging.framework with Carthage finished.
/Users/phvillegas/app/node_modules/infobip-mobile-messaging-react-native-plugin

Configurations:

package.json:

"react-native": "0.63.4",
"infobip-mobile-messaging-react-native-plugin": "^2.6.0"

Hope someone can help me.
Thanks!

Runtime crash - React Native Huawei

React Native Infobip for Huawei app crashes in release build after update of mobile-messaging-react-native-plugin v6.3.3

mobile-messaging-sdk-huawei v2.2.3

Fatal Exception: java.lang.RuntimeException: Could not invoke ReactNativeMobileMessaging.init
       at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:383)
       at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:151)
       at com.facebook.react.bridge.queue.NativeRunnable.run(NativeRunnable.java)
       at android.os.Handler.handleCallback(Handler.java:900)
       at android.os.Handler.dispatchMessage(Handler.java:103)
       at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:27)
       at android.os.Looper.loop(Looper.java:219)
       at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:226)
       at java.lang.Thread.run(Thread.java:929)

React Native - 0.65.1

[iOS] Example project: Build Failed

Tried to build example project from repo on iOS.

Before build:

> yarn
> cd ios
> pod install

Result:

Screenshot 2021-07-28 at 22 56 29

Environment:
Xcode 12.5.1
CocoaPods 1.10.1


One of solution:

ios/Podfile

......

use_frameworks!

target 'Example' do

  ......

  $static_framework = [
    'react-native-safe-area-context',
    'React-RCTText',
    'RNReanimated'
  ]
    
  pre_install do |installer|
    Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {}

    installer.pod_targets.each do |pod|
      if $static_framework.include?(pod.name)
        def pod.build_type;
          Pod::BuildType.static_library
        end
      end
    end
  end
end

The following build commands failed:

    CpResource /Users/xxx/Downloads/app/src/assets/fonts/reost-semibold.otf /Users/xxx/Library/Developer/Xcode/DerivedData/travel-dftjgjmdydcfaihhcfrbcmcfwzzp/Build/Products/Debug-iphonesimulator/travel.app/reost-semibold.otf
    CpResource /Users/xxx/Downloads/react-native-travel-app-main/src/assets/fonts/reost-medium.otf /Users/xxx/Library/Developer/Xcode/DerivedData/travel-dftjgjmdydcfaihhcfrbcmcfwzzp/Build/Products/Debug-iphonesimulator/travel.app/reost-medium.otf
    CpResource /Users/xxx/Downloads/react-native-travel-app-main/src/assets/fonts/reost-light.otf /Users/xxx/Library/Developer/Xcode/DerivedData/travel-dftjgjmdydcfaihhcfrbcmcfwzzp/Build/Products/Debug-iphonesimulator/travel.app/reost-light.otf

(3 failures)

Push notifications is not working in React Native

Hi,

Thank you for RN Plugin.

I have implemented the below code to insert user information on the Infobip portal. But always inserting unexpected information on Portal and Push notification is not working.

Requirement
We want to register an email address on the portal. Because as per our requirements sending to push notification on phone, we are using user email Id and push ID.
But in React Native case ID parameter is always inserting default random ID.

Maybe because of that, failing the Notification in React Native.

**Note:-**I have done the same implementation in native iOS it's inserting expected information on Portal and working notification also for the phone.

I have attached both images for references.

Implementation:-

Calling for initialization:-
import { mobileMessaging } from "infobip-mobile-messaging-react-native-plugin";
mobileMessaging.init(
{```

applicationCode:
  "here infobip application code",
ios: {
  notificationTypes: ["alert", "badge", "sound"]
}

},
() => {
console.log('MobileMessaging started');
},
error => {
console.log('MobileMessaging error: ', error);
},
);

mobileMessaging.register('registrationUpdated', message => {
console.log('Event received', message);

});

User information Register to Infobip Portal:-

const user = {
externalUserId: "[email protected]",
firstName: "PP",
lastName: "Dubey",
phones: ["9710000000"],
emails: ["[email protected]"],
};
);

mobileMessaging.saveUser(
user,
user => {
console.log("Inserted data on Success", user);
},
user => {
console.log("Inserted data error", user);
}
);
Please help us with this scenario and let's know if we are missing any implementation for the same.

Thanks,
Pratius

iOS-Native-Portal-ScreenShot

React-Native-Portal-Screen-Shots

MobileMessagingChatImages.car" not found

Hello Team, I followed the instructions mentioned on README.md file and got the following error:

error: Resource "/Users/user/Library/Developer/Xcode/DerivedData/App-hababimzkwlhcoddzzjplphyfkci/Build/Products/Debug-iphonesimulator/MobileMessaging/MobileMessaging.framework/MobileMessagingChatImages.car" not found. Run 'pod install' to update the copy resources script.

Configurations:

package.json:

"react-native": "0.63.4",
"infobip-mobile-messaging-react-native-plugin": "^2.5.2"

Podfile

platform :ios, '10.0'
use_frameworks! :linkage => :static

Hope someone can help in integration to iOS

Cannot receive tapped notification event when app is closed

Hi! I can not receive tapped notification event when the app is closed. I'm using SDK 8.0.0 on Android 12, getting this error when tap on the notification message:

04-17 15:51:17.891 10157  6183  6457 D RNMobileMessaging: Will not migrate cryptor :
04-17 15:51:17.892 10157  6183  6457 W System.err: java.lang.ClassNotFoundException: org.infobip.mobile.messaging.cryptor.ECBCryptorImpl
04-17 15:51:17.892 10157  6183  6457 W System.err: 	at java.lang.Class.classForName(Native Method)
04-17 15:51:17.893 10157  6183  6457 W System.err: 	at java.lang.Class.forName(Class.java:454)
04-17 15:51:17.895 10157  6183  6457 W System.err: 	at java.lang.Class.forName(Class.java:379)
04-17 15:51:17.895 10157  6183  6457 W System.err: 	at org.infobip.reactlibrary.mobilemessaging.ReactNativeMobileMessagingModule.init(ReactNativeMobileMessagingModule.java:384)
04-17 15:51:17.895 10157  6183  6457 W System.err: 	at java.lang.reflect.Method.invoke(Native Method)
04-17 15:51:17.896 10157  6183  6457 W System.err: 	at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:372)
04-17 15:51:17.896 10157  6183  6457 W System.err: 	at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:188)
04-17 15:51:17.897 10157  6183  6457 W System.err: 	at com.facebook.jni.NativeRunnable.run(Native Method)
04-17 15:51:17.898 10157  6183  6457 W System.err: 	at android.os.Handler.handleCallback(Handler.java:938)
04-17 15:51:17.899 10157  6183  6457 W System.err: 	at android.os.Handler.dispatchMessage(Handler.java:99)
04-17 15:51:17.899 10157  6183  6457 W System.err: 	at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:27)
04-17 15:51:17.899 10157  6183  6457 W System.err: 	at android.os.Looper.loopOnce(Looper.java:201)
04-17 15:51:17.900 10157  6183  6457 W System.err: 	at android.os.Looper.loop(Looper.java:288)
04-17 15:51:17.900 10157  6183  6457 W System.err: 	at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:228)
04-17 15:51:17.900 10157  6183  6457 W System.err: 	at java.lang.Thread.run(Thread.java:920)
04-17 15:51:17.901 10157  6183  6457 W System.err: Caused by: java.lang.ClassNotFoundException: Didn't find class "org.infobip.mobile.messaging.cryptor.ECBCryptorImpl" on path: DexPathList[[zip file "/data/app/~~nr8CSaI7bVYmde_3fVICeA==/com.sunnylab-xa3piZpoYY3DfbCdMFaZYQ==/base.apk"],nativeLibraryDirectories=[/data/app/~~nr8CSaI7bVYmde_3fVICeA==/com.sunnylab-xa3piZpoYY3DfbCdMFaZYQ==/lib/x86_64, /data/app/~~nr8CSaI7bVYmde_3fVICeA==/com.sunnylab-xa3piZpoYY3DfbCdMFaZYQ==/base.apk!/lib/x86_64, /system/lib64, /system_ext/lib64]]
04-17 15:51:17.902 10157  6183  6457 W System.err: 	at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:218)
04-17 15:51:17.903 10157  6183  6457 W System.err: 	at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
04-17 15:51:17.903 10157  6183  6457 W System.err: 	at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
04-17 15:51:17.904 10157  6183  6457 W System.err: 	... 15 more

Push notifications conflicts

Hi!
I encountered a notification problem (notifee) if infobip is installed. Now I can’t launch local push notifications because they don’t appear, or rather end up in infobip. Is it possible to make it so that there are exceptions?

thanks in advance

reactlibrary/mobilemessaging/ReactChatView.java:65: error: cannot find symbol

Hello Team, I have integrated on iOS and it seems that integration is properly setup, however on Android the app is breaking on run time. The error message while running the app is this node_modules/infobip-mobile-messaging-react-native-plugin/android/src/main/java/org/infobip/reactlibrary/mobilemessaging/ReactChatView.java:65: error: cannot find symbol. Please check the screen shot for more clarification.

Screenshot 2021-02-04 at 3 11 39 PM

Screenshot 2021-02-04 at 3 11 52 PM

I have followed down below steps, still it fails:

Screenshot 2021-02-04 at 3 18 52 PM

Configurations:
Android Studio: 4.1.2
React Native : 0.61.3
mobile-messaging-react-native-plugin: 2.5.0

Help will be appreciated. @riskpp @tjuric

On android when app is killed/closed, library events are not triggering

Below I've pasted my snippet for initializing the SDK and registering the notificationTapped event.
SDK is initializing properly and device is also getting register on infobip portal.
When sending the push from portal and receiving on android device, after tapping the notification
notificationTapped library event won't trigger in android.

import { mobileMessaging } from 'infobip-mobile-messaging-react-native-plugin';
mobileMessaging.init(
{
applicationCode: Config.INFOBIP_KEY,
ios: {
notificationTypes: ['alert', 'badge', 'sound'],
},
},
() => {
console.log('MobileMessaging started');
},
error => {
console.log('MobileMessaging error: ', error);
}
);

mobileMessaging.register('registrationUpdated', message => {
        console.log('Event received', message);
})
mobileMessaging.register("notificationTapped", message => {
  alert(message.body)
});

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.