Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Firebase Analytics and Push Notifications
Started by DevilSquid – René Dec 07 2017 06:53 AM

34 replies to this topic
[TOPIC CONTROLS]
Page 1 of 2 1 2
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

DevilSquid – René

[GLOBAL: userInfoPane.html]
DevilSquid – René
  • Contributor

  • 157 posts
  • Corona SDK

Hello Community,

 

it seems that Scott Techs Firebase Analytics and Corona's notifications v2 plugin does somehow collide.

If I require and initialize both in main.lua one ot the other does not work anymore.

 

Is this possible? Maybe some "namespace issues"? (just guessing).

Any idea if there is way to bring both to life?

 

Thanks in advance
René



[TOPIC: post.html]
#2

Scott Harrison

[GLOBAL: userInfoPane.html]
Scott Harrison
  • Corona Geek

  • 1,765 posts
  • Enterprise

You should try using a timer for init each one, for example. Notification init at 100 milliseconds and analytics at 200 milliseconds.

[TOPIC: post.html]
#3

DevilSquid – René

[GLOBAL: userInfoPane.html]
DevilSquid – René
  • Contributor

  • 157 posts
  • Corona SDK

Ok, I will give it a try!



[TOPIC: post.html]
#4

DevilSquid – René

[GLOBAL: userInfoPane.html]
DevilSquid – René
  • Contributor

  • 157 posts
  • Corona SDK

Unfortunately this des not help. I even tried to setup notifications in a scene that is loaded later.

But as soon as firebase analytics is used the registering for remote notifications does not fire.

Maybe any other ideas?



[TOPIC: post.html]
#5

Scott Harrison

[GLOBAL: userInfoPane.html]
Scott Harrison
  • Corona Geek

  • 1,765 posts
  • Enterprise

Can you please file a bug report

 

https://docs.google.com/forms/d/e/1FAIpQLSf-V3z-V3FZ5y9Sb19cxVfjx7fSRV9HIbpAGptN7DaY3Ki_DA/viewform



[TOPIC: post.html]
#6

DevilSquid – René

[GLOBAL: userInfoPane.html]
DevilSquid – René
  • Contributor

  • 157 posts
  • Corona SDK

I have filed a bug report. I added a link to a simple main.lua but of course you would need to prepare your test app for firebase push notifications with your own firebase credentials. 



[TOPIC: post.html]
#7

Scott Harrison

[GLOBAL: userInfoPane.html]
Scott Harrison
  • Corona Geek

  • 1,765 posts
  • Enterprise

This has been patched



[TOPIC: post.html]
#8

DevilSquid – René

[GLOBAL: userInfoPane.html]
DevilSquid – René
  • Contributor

  • 157 posts
  • Corona SDK

Hey Scott,

 

I already mailed you that the problem still occurs on my side.

I have no experience in plugin development, so I don't know if the following information might be useless to you.

 

 

I talked to a someone else who used the iOS Firebase SDK with Corona Native.
He said he had to set FirebaseAppDelegateProxyEnabled type "Boolean" to "NO". Otherwise the Push Notifications did not work.



[TOPIC: post.html]
#9

DevilSquid – René

[GLOBAL: userInfoPane.html]
DevilSquid – René
  • Contributor

  • 157 posts
  • Corona SDK

Sorry, that informations was useless:
we already use FirebaseAppDelegateProxyEnabled = false in the build.settings.



[TOPIC: post.html]
#10

Scott Harrison

[GLOBAL: userInfoPane.html]
Scott Harrison
  • Corona Geek

  • 1,765 posts
  • Enterprise

You made an error in your sample code
firebaseAnalytics.logEvent("test2")

should be

firebaseAnalytics.logEvent("test2", {data="hello world"})

You need to pass a table into the second param



[TOPIC: post.html]
#11

DevilSquid – René

[GLOBAL: userInfoPane.html]
DevilSquid – René
  • Contributor

  • 157 posts
  • Corona SDK

Ok, but even this small example does not work:

local notifications = require('plugin.notifications.v2')
local firebaseAnalytics = require( "plugin.firebaseAnalytics" )

firebaseAnalytics.init()

local function notificationListener( event )
	print('Event:' .. event.type)
end

Runtime:addEventListener('notification', notificationListener)

timer.performWithDelay( 4000, function() 
    notifications.registerForPushNotifications({useFCM=true})
end)

Here I do not even use a logEvent().  If I remove the firebaseAnalytics.init() then the registerForPushNotifications does work (the popup fires). If I do not remove the init() call the popup does not show up.



[TOPIC: post.html]
#12

Scott Harrison

[GLOBAL: userInfoPane.html]
Scott Harrison
  • Corona Geek

  • 1,765 posts
  • Enterprise

Ok, but even this small example does not work:

local notifications = require('plugin.notifications.v2')
local firebaseAnalytics = require( "plugin.firebaseAnalytics" )

firebaseAnalytics.init()

local function notificationListener( event )
	print('Event:' .. event.type)
end

Runtime:addEventListener('notification', notificationListener)

timer.performWithDelay( 4000, function() 
    notifications.registerForPushNotifications({useFCM=true})
end)

Here I do not even use a logEvent().  If I remove the firebaseAnalytics.init() then the registerForPushNotifications does work (the popup fires). If I do not remove the init() call the popup does not show up.

trying initing after registering

local notifications = require('plugin.notifications.v2')
local firebaseAnalytics = require( "plugin.firebaseAnalytics" )



local function notificationListener( event )
	print('Event:' .. event.type)
end

Runtime:addEventListener('notification', notificationListener)

timer.performWithDelay( 4000, function() 
    notifications.registerForPushNotifications({useFCM=true})
    firebaseAnalytics.init()
end)


[TOPIC: post.html]
#13

DevilSquid – René

[GLOBAL: userInfoPane.html]
DevilSquid – René
  • Contributor

  • 157 posts
  • Corona SDK

Ok I can try this. But this will be not useful in most cases.

I already need to log system events like app resume, app suspend, app start and app exit. These events occur at the very beginning of the app life cycle.

Furthermore requesting access for push notifications should be done strategically later in the game.



[TOPIC: post.html]
#14

Scott Harrison

[GLOBAL: userInfoPane.html]
Scott Harrison
  • Corona Geek

  • 1,765 posts
  • Enterprise

I will investigate if there is more I can do

[TOPIC: post.html]
#15

DevilSquid – René

[GLOBAL: userInfoPane.html]
DevilSquid – René
  • Contributor

  • 157 posts
  • Corona SDK

That would be great. Thank you for your endurance!

Using Firebase for Analytics and Push Notifications is really an important and powerful tool set!



[TOPIC: post.html]
#16

Scott Harrison

[GLOBAL: userInfoPane.html]
Scott Harrison
  • Corona Geek

  • 1,765 posts
  • Enterprise

That would be great. Thank you for your endurance!

Using Firebase for Analytics and Push Notifications is really an important and powerful tool set!

Just a quick update I have looked into this pretty hard and have not had a lot of luck. Unforchantly corona has not open sourced the notification which would help a lot but I really cannot do anything about this. For the record this what my code objc for init is

[FIRApp configure];
 

Yep that simple

 

I think you are going to have better luck corona support or filing a bug report with them.

Thanks,

Scott



[TOPIC: post.html]
#17

DevilSquid – René

[GLOBAL: userInfoPane.html]
DevilSquid – René
  • Contributor

  • 157 posts
  • Corona SDK

Hey Scott,

 

thank you for looking into this again.

I will ask Corona support on this issue.

 

Best

René



[TOPIC: post.html]
#18

troylyndon

[GLOBAL: userInfoPane.html]
troylyndon
  • Contributor

  • 530 posts
  • Corona SDK

@Scott and @Rene, did the latest Corona Notifications update in April 2018 resolve this issue?



[TOPIC: post.html]
#19

troylyndon

[GLOBAL: userInfoPane.html]
troylyndon
  • Contributor

  • 530 posts
  • Corona SDK

attempt #2, @Scott and @Rene, did the latest Corona Notifications update in April 2018 resolve this issue?



[TOPIC: post.html]
#20

Scott Harrison

[GLOBAL: userInfoPane.html]
Scott Harrison
  • Corona Geek

  • 1,765 posts
  • Enterprise

I am not sure, it should be but I don’t keep track off other developers plugins

[TOPIC: post.html]
#21

troylyndon

[GLOBAL: userInfoPane.html]
troylyndon
  • Contributor

  • 530 posts
  • Corona SDK

@Scott, because the newest Corona notifications uses Firebase, the failure of your Firebase plugin on Android 8+ was the reason for my last post. Please do not be offended by my question related to the notifications. To be more clear, unless we can properly populate Firebase via your plugin on Android 8+, the Corona notifications will not work. We verified this morning that all works fine on iOS and Android <8.0. This is why two plugins are related.



[TOPIC: post.html]
#22

Scott Harrison

[GLOBAL: userInfoPane.html]
Scott Harrison
  • Corona Geek

  • 1,765 posts
  • Enterprise

^ I don’t have android 8.0 device so can not check this :(. It may be the firebase version which I can not change in my plugin. I don’t think I have the means to fix this. I want to do more but based on your specific problem there is very little I can do. I only have 6.0 and 5.0 android device I test on. Honestly this is the only complaint I have gotten so far so I don’t know if setup issue. If you can give me any error messages from logs that would be helpful

[TOPIC: post.html]
#23

DevilSquid – René

[GLOBAL: userInfoPane.html]
DevilSquid – René
  • Contributor

  • 157 posts
  • Corona SDK

@troylyndon since I did not manage to run FB Analytics and PNs like we wanted we decided to not use Firebase PNs.



[TOPIC: post.html]
#24

troylyndon

[GLOBAL: userInfoPane.html]
troylyndon
  • Contributor

  • 530 posts
  • Corona SDK

@ScottH, I sent you 3 PMs to make provision to get you a device. Please respond when you can.



[TOPIC: post.html]
#25

Scott Harrison

[GLOBAL: userInfoPane.html]
Scott Harrison
  • Corona Geek

  • 1,765 posts
  • Enterprise

@ScottH, I sent you 3 PMs to make provision to get you a device. Please respond when you can.

I just responed




[topic_controls]
Page 1 of 2 1 2
 
[/topic_controls]