B4A Library FirebaseNotifications - Push messages / Firebase Cloud Messaging (FCM)

Status
Not open for further replies.

scsjc

Well-Known Member
Licensed User
Longtime User
Hello,
Someone know why the "Console Firebase Notification" don't work with a notification with a same way going to "fm_MessageArrived"

because i test, and always when use a Console have a notification from app but dont work the code inside "fm_MessageArrived"
and when send a message via PHP or via ANDROID, work perfectly.

I want work with a console because i have %clicks send number notifications bla bla bla

thanks!!!
 

scsjc

Well-Known Member
Licensed User
Longtime User
You should use the B4J or B4A code posted in the first post. You can send whichever data you need.

yes ... i now...i use.... but the nice from Console is the Statistics for that i want i try to work with console
 

An Schi

Well-Known Member
Licensed User
It is a limitation of the console. Somehow pushes from the console don't start your service like the ones from the API do. It is documented in stackoverflow, sorry i don't have the link at hand (but i posted it allready some time ago to another thread).
 

iCAB

Well-Known Member
Licensed User
Longtime User
Hi All

Since all what it takes is a simple HTTP request to send a message to a topic, is it safe to assume that we don't need a server at all to create a messaging platform between mobile devices provided that each of the devices knows the server API Key.

Something similar to this
1. At startup: a mobile device retrieves encrypted API key from server
2. Mobile devices subscribe to unique topics for receiving private messages ( for example: user's email address )
3. Mobile device subscribe to common topics for receiving broadcast messages
4. A mobile device can send a broadcast or a private message to another device by simply sending to known topics

One more related question:
Is there a limit to the number of topics a client can subscribe to?


Please comment
Thanks in advance
 
Last edited:

Alpandino

Member
Licensed User

Hi all, I dealt the problem and I finally understood the root cause. I want to share the solution with you: the problem was the fact that I made the Starter service as sticky. If I remove the stickyness of starter service everything works really fine, I'm able to receive each message, at any time, also if I stop manually my app.
I don't understand why, but this is the solution
I hope this can be useful for other users

Bye
 

iCAB

Well-Known Member
Licensed User
Longtime User
Hi All

I am trying to make sure I understand the exact startup sequence
In the first post

We call SubscribeToTopics from the starter service to make sure that the app will be subscribed when it starts:

How do we know that by the time SubscribeToTopics is called, fm is already initialized and registered, and if not what is the Proper way of checking this.

Thanks
 
Last edited:

alimanam3386

Active Member
Licensed User
Longtime User
Hi

How can you make sure that if we put the server key in client side it will be safe ? If we encrypt it ( server key ) we have to decrypt it in client side again !
 

iCAB

Well-Known Member
Licensed User
Longtime User
How can you make sure that if we put the server key in client side it will be safe ? If we encrypt it ( server key ) we have to decrypt it in client side again !

In my case, I decrypt the key on the client side and assign it to a global variable( never saved to a file ). You can address the issue in many ways, it all depends on how much security you need.
 

alimanam3386

Active Member
Licensed User
Longtime User
In my case, I decrypt the key on the client side and assign it to a global variable( never saved to a file ). You can address the issue in many ways, it all depends on how much security you need.

Hi
But if you decrypt the server key in client side your users can get it easy ! ( by decrpt the apk )
 

iCAB

Well-Known Member
Licensed User
Longtime User
Hi
But if you decrypt the server key in client side your users can get it easy ! ( by decrpt the apk )

To the best of my knowledge, if the key (encrypted/decrypted), is not being stored anywhere in a file, it will be extremely hard to get, unless you are talking about decompiling the code and figuring out the encryption algorithm used.

I don't have in depth knowledge of the android OS and the compiler etc.. so I will leave that to one of the experts to comment on.
 

alimanam3386

Active Member
Licensed User
Longtime User

Yes exactly , if we decompile the apk we can get the algorithm of encryption/decryption and it's equals with server key.
 

iCAB

Well-Known Member
Licensed User
Longtime User
Yes exactly , if we decompile the apk we can get the algorithm of encryption/decryption and it's equals with server key.

If you can do that, then nothing prevents you from achieving the same results regardless of where the key resides (on the server or in the app ). As far as I know there are only couple of ways of doing this:

1. Directly from the app using the key ( note that in my proposed solution, the key is exchanged in encrypted format and using a secure handshake that authenticate the client. The key resides in some global variable )

2. issue a message to the server, to forward the message (one way or the other ) to the addressed device.

if you can decompile the code neither one is secure.

Perhaps Erel or one of the security experts on the site can elaborate
 
Last edited:

iCAB

Well-Known Member
Licensed User
Longtime User
Strings that are set in Sub Process_Globals will be obfuscated. It adds some protection.

Here is what I am trying to understand based on the conversation above and based on the fact that someone can decompile the apk in an attempt to hack the system.

1. In my solution, the server API key is not part of the apk at all
2. The key is exchanged between the server and the client in encrypted format and using a secure http handshake (session keys, message signing etc.. )
3. The descrypted key is stored in a Global variable and not in a file


1. Is it possible for someone to get access to the key based on the above? I am not talking about decrypting the key at this point. Just accessing the variable holding the key in memory

2. assuming that someone is attempting to hack the system, wouldn't it be easier to figure out a way to send messages to the small B4J server than figuring out the encryption used to retrieve the key

Please comment
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…