RNBackendless to support RN 0.59+ for Google 64bits requirement

Hi guys, according to Google Play “All new apps and app updates that include native code are required to provide 64-bit versions in addition to 32-bit versions when publishing an App.”

I already got an alert on Google Play before submitting the app to review, which forces me to update the RN to 59.5 because React-native team workout on version 59+ to support 64-bit.

I updated the React Native to the latest version “0.59.5” and I had no issues on Android but I did get errors on iOS from NotificationService folder.

Hi Marcio

I’ve tested it today with react-native@59.5, works well without any issues

could you please check Link Binary With Libraries section in your xcode project for NotificationService target https://github.com/Backendless/React-Native-JS-SDK/blob/master/doc/ios/guide.md#add-notification-service-extension

and also check this Other Linker Flags section

-ObjC
$(inherited)
-lc++

if it does not help, I’ll contact to our ios developers to take a look into the issue

Regards, Vlad

Yes @vladimir-upirov, I double checked it’s all there, the error persists.

Could you update the project on Git to give a look in your changes? I was following the rn-diff-purge as advised here: Releasing React Native 0.59 · React Native

found very similar problem on github https://github.com/facebook/react-native/issues/23183

Hi @vladimir-upirov, I notice your example already has the JavaScriptCore.framework on it. I added to my project but didn’t solve, I’ll keep trying some alternatives tomorrow. Regards

Hi Marcio, I’ve upgrade my older app to the latest versions, here is git history Commits · Valodya/backendless-react-native-example · GitHub

I had problems with android build, but maybe it was due to upgrading my Android Studio or something else, anyways, now my android app is building and running without any errors.
And only after that I got started to configure iOS app step by step. During the setting I faced on with the same errors, but only for main build target


and adding JavaScriptCore.framework solve the issues

here is my env:

Valodyas-MBP-2:RNPushDemo valodyaupirov$ react-native info
info 
  React Native Environment Info:
    System:
      OS: macOS 10.14.4
      CPU: (8) x64 Intel(R) Core(TM) i7-3720QM CPU @ 2.60GHz
      Memory: 31.18 MB / 8.00 GB
      Shell: 3.2.57 - /bin/bash
    Binaries:
      Node: 10.15.3 - ~/.nvm/versions/node/v10.15.3/bin/node
      npm: 6.4.1 - ~/.nvm/versions/node/v10.15.3/bin/npm
    SDKs:
      Android SDK:
        API Levels: 26, 27, 28
        Build Tools: 27.0.3, 28.0.3
        System Images: android-28 | Intel x86 Atom, android-28 | Intel x86 Atom_64
    IDEs:
      Android Studio: 3.4 AI-183.5429.30.34.5452501
      Xcode: /undefined - /usr/bin/xcodebuild
    npmPackages:
      react: ^16.8.6 => 16.8.6 
      react-native: ^0.59.5 => 0.59.5 
    npmGlobalPackages:
      react-native-cli: 2.0.1
      react-native-create-library: 3.1.2

Hope my git history will help you. Please let me know if it helped or if you found another solution of your problem.

Regards, Vlad

Hi @vladimir-upirov sorry for the delay, I can’t make this work. It is crashing the App when you try to open from the notification.

I removed the module from iOS and return to PushNotificationIOS, issue about 64bits solved and not crashing when I receive a notification, but I can’t use it for Android too, still have crashing issues with the App.

I have update all node_modules, working fine on both but still crashing with notification.

Do you have any suggestion as workaround that could be used with appstate to avoid the notification action? I don’t mind if the user clicks and do not fire the App, since they get the notification, that whats really matters… they also receive an email and can’t open the app from there either so no problem.

The App is already approved on Google Play and Apple store, Google on beta.

When the App crashes a few times, Android gives you an alert to remove the App, not good!

Here’s my real scenario:

React Native Environment Info:
System:
OS: Windows 10
CPU: x64 Intel® Core™ i7-7700K CPU @ 4.20GHz
Memory: 23.51 GB / 31.93 GB
Binaries:
Yarn: 1.10.1 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
npm: 6.4.1 - C:\Program Files\nodejs\npm.CMD
IDEs:
Android Studio: Version 3.4.0.0 AI-183.5429.30.34.5452501
npmPackages:
@react-native-community/async-storage”: “^1.3.4”,
@react-native-community/netinfo”: “^2.0.10”,
@types/yup”: “^0.26.3”,
“axios”: “^0.18.0”,
“babel-core”: “^6.26.3”,
“babel-plugin-transform-remove-console”: “^6.9.4”,
“backendless”: “^5.2.10”,
“backendless-react-native”: “^0.1.3”,
“eslint”: “^5.16.0”,
“formik”: “^1.5.4”,
“i18n-js”: “^3.2.1”,
“intl”: “^1.2.5”,
“jsc-android”: “236355.1.1”,
“moment”: “^2.24.0”,
“prop-types”: “^15.7.2”,
“react”: “16.8.6”,
“react-native”: “0.59.8”,
“react-native-device-info”: “^1.6.2”,
“react-native-dotenv”: “^0.2.0”,
“react-native-elements”: “^1.1.0”,
“react-native-fast-image”: “^6.0.0”,
“react-native-fbsdk”: “^0.8.0”,
“react-native-gesture-handler”: “^1.2.1”,
“react-native-image-picker”: “^0.28.1”,
“react-native-iphone-x-helper”: “^1.2.0”,
“react-native-keyboard-aware-scroll-view”: “^0.8.0”,
“react-native-lightbox”: “^0.8.0”,
“react-native-linear-gradient”: “^2.5.4”,
“react-native-localize”: “^1.1.2”,
“react-native-maps”: “^0.24.2”,
“react-native-modal”: “^11.0.0”,
“react-native-modal-datetime-picker”: “^7.4.0”,
“react-native-phone-call”: “^1.0.9”,
“react-native-screens”: “^1.0.0-alpha.22”,
“react-native-splash-screen”: “3.2.0”,
“react-native-swipeout”: “^2.3.6”,
“react-native-swiper”: “^1.5.14”,
“react-native-timer”: “^1.3.6”,
“react-native-vector-icons”: “^6.4.2”,
“react-navigation”: “^3.9.1”,
“react-redux”: “^7.0.3”,
“redux”: “^4.0.1”,
“toggle-switch-react-native”: “^2.0.2”,
“yup”: “^0.27.0”

Hi Marcio

Do you have any suggestion as workaround that could be used with appstate to avoid the notification action? I don’t mind if the user clicks and do not fire the App, since they get the notification, that whats really matters… they also receive an email and can’t open the app from there either so no problem.

not sure there is an easy way, I suspect without injection in NativeCode it’s not possible

Could you provide a stack trace of the crashing (on receive a notification)?

It’s hard to solve the issue without running, would be nice if you provide a project with this problem which I can run in my machine, and see what’s going on when a new notification is received.

  • You can get your project,
  • copy/clone it into a different directory
  • remove any secret values, including google-services.json file
  • remove node_modules directory
  • archive it
  • and send us the archive to support@backendless.com

Regards, Vlad

1 Like

Sent @vladimir-upirov, thanks for the support! Regards

Hey Marcio

Thanks for share your app for investigation, but actually it works for me without any crashing. I’ve recorded a video to demonstrate it (sent it to email). I sent three kind of push notifications

  1. simple push through API
  2. complex push (with additional headers) through API
  3. and used push template

and as you can see on that video all the notifications are received and on tap the app opens.

So, maybe the issue is somewhere, perhaps it’s related to a push notification payload or maybe with another module

Also, in the email I’ve attached your app with my changes (I had to change some keys)

Regards, Vlad

Hi @Vladimir, thanks for all support. I did try on an emulator and indeed it does not crash the App, for me just restart but it does crash the App when running on Device.

Also sent through the Backendless dashboard template and the result was the same, open normal on emulator and crash on the device, which means is not my payload.

Did you try on a real device? I’m worried because Android alerts after 2 3 crashes.

I’m looking for battery related issues on Android 9.

Hi Marcio

Yes, I tried with a real device

Can you see any error logs from your device?

No, just crash. I tried with adb logcat and get nothing on start.

adb logcat *:S ReactNative:V ReactNativeJS:V

I’m changing everything related with the battery on my device and testing, nothing seems to work.

try to open your android project in Android Studio and run it from there

Just this warning:

WARNING: The following project options are deprecated and have been removed:
android.enableAapt2

This property has no effect, AAPT2 is now always used.
Affected Modules: @react-native-community_async-storage, app, backendless-react-native, react-native-community-netinfo, react-native-fast-image, react-native-fbsdk, react-native-gesture-handler, react-native-image-picker, react-native-linear-gradient, react-native-localize, react-native-maps, react-native-splash-screen, react-native-vector-icons

and could you try to run app with my changes and keys, once the device is registered you can send a push notification from my backendless app by the next curl

curl -X "POST" "https://api.backendless.com/5337DEB0-BE36-32E7-FF41-891739299E00/AB63245C-134B-F4A6-FFC2-DE8ABB4D2000/services/PushService/sendAdvancedApiPush" \
	-H 'Content-Type: application/json' \
	-H 'Accept: application/json'

instead of sendAdvancedApiPush you can also use these two methods:

  • sendSimpleApiPush
  • sendTest - it’s push with template

I got something else:

I/RNBackendless: Received a new Push Notification Message: Bundle[{android-ticker-text=Your Order has been Accepted!, playSound=true, smallIcon=ic_notification, messageId=message:1ADD16A0-87ED-4E4B-980B-54A75F4A3CA5, ongoing=true, priority=low, lights=true, ios-badge=1, ios-sound=Default, vibration=300, alert=true, badge=true, group=group, vibrate=true, ios-alert-body=John, android-content-title=Your Order has been Accepted!, wake_screen=true, largeIcon=ic_launcher, message=John, BL_APPLICATION_ID=9CA9AA41-6892-4A1E-FFB5-95DEAF5A4A00, importance=low}]
D/RNBackendless: Handle Remote Push Notification: Bundle[{android-ticker-text=Your Order has been Accepted!, playSound=true, smallIcon=ic_notification, messageId=message:1ADD16A0-87ED-4E4B-980B-54A75F4A3CA5, ongoing=true, priority=low, lights=true, ios-badge=1, ios-sound=Default, vibration=300, alert=true, badge=true, group=group, vibrate=true, ios-alert-body=John, android-content-title=Your Order has been Accepted!, wake_screen=true, largeIcon=ic_launcher, message=John, BL_APPLICATION_ID=9CA9AA41-6892-4A1E-FFB5-95DEAF5A4A00, importance=low}]
create empty Push Notification Template: com.reactlibrary.RNBackendlessPushNotificationTemplate@9c34cd5
Push notification template: com.reactlibrary.RNBackendlessPushNotificationTemplate@9c34cd5
I/RNBackendless: Send Push Notification to Notification Center: Bundle[{android-ticker-text=Your Order has been Accepted!, playSound=true, smallIcon=ic_notification, messageId=message:1ADD16A0-87ED-4E4B-980B-54A75F4A3CA5, ongoing=true, priority=low, lights=true, ios-badge=1, ios-sound=Default, vibration=300, alert=true, badge=true, group=group, vibrate=true, ios-alert-body=John, android-content-title=Your Order has been Accepted!, wake_screen=true, largeIcon=ic_launcher, message=John, BL_APPLICATION_ID=9CA9AA41-6892-4A1E-FFB5-95DEAF5A4A00, importance=low}]
V/RNBackendless: Send “notification” event to JS Code, params: { NativeMap: {“customHeaders”:{},“message”:“John”,“title”:“Your Order has been Accepted!”,“id”:1339848131} }

D/RNBackendless: RNBackendlessPushNotificationActionReceiver receive an action: Bundle[mParcelledData.dataSize=236]
D/AndroidRuntime: Shutting down VM
E/AndroidRuntime: FATAL EXCEPTION: main
Process: online.feedup, PID: 26301
java.lang.RuntimeException: Unable to start receiver com.reactlibrary.RNBackendlessPushNotificationActionReceiver: android.util.AndroidRuntimeException: Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want?
at android.app.ActivityThread.handleReceiver(ActivityThread.java:3584)
at android.app.ActivityThread.access$1300(ActivityThread.java:235)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1779)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:6981)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1445)
Caused by: android.util.AndroidRuntimeException: Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want?
at android.app.ContextImpl.startActivity(ContextImpl.java:974)
at android.app.ContextImpl.startActivity(ContextImpl.java:950)
at android.content.ContextWrapper.startActivity(ContextWrapper.java:384)
at android.content.ContextWrapper.startActivity(ContextWrapper.java:384)
at com.reactlibrary.RNBackendlessPushNotificationActionReceiver.onReceive(RNBackendlessPushNotificationActionReceiver.java:40)
at android.app.ActivityThread.handleReceiver(ActivityThread.java:3575)
at android.app.ActivityThread.access$1300(ActivityThread.java:235)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1779)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:6981)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1445)

I/Process: Sending signal. PID: 26301 SIG: 9
Application terminated.

That’s what I got when I tap on the notification to open the App. It crashes…

good, now we know where is the problem, but we have to figure out why it works for me and doesn’t for you.

I can assume two potential differences:

  1. app code - could you run the same code as I run (with my keys)
  2. real device (mine and yours) - please provide what’s device do you use, and I’ll create an emulator and try to reproduce the problem