i lunch it on new project and new form i add the dependency but the page stay complitly empty and on console is not printing the variable “device_token”
How can be fixed ?
The issue can be from some google auth prametrs to configure ?
If i can have more information can be great! Thank you!
Are you trying to add this to the form init method? Because that’s usually a bad idea since it will block the rest of code. Try adding it to form_show.
Hello, thanks for replay, i try to put it on show like here:
Blockquote
from ._anvil_designer import Form1Template
from anvil import *
import anvil.server
import anvil.facebook.auth
import anvil.google.auth, anvil.google.drive
from anvil.google.drive import app_files
import anvil.users
import anvil.tables as tables
import anvil.tables.query as q
from anvil.tables import app_tables
from Push_Notifications import firebase
#device_token = firebase.request_push_notifications() #print(device_token)
class Form1(Form1Template):
def init(self, **properties):
# Set Form properties and Data Bindings.
self.init_components(**properties) #anvil.users.login_with_form()
# Any code you write here will run when the form opens.
c=app_tables.users.add_row(token=device_token)
print(c)
"""This method is called when the column panel is shown on the screen"""
pass
“”"
from the console is not print anytingh and not gives some error but always same think is not show the token.
Can be someting to be change on the dependency code i mean on the:
“”"
serviceworker=navigator.serviceWorker.register(“_/api/service-worker.js”)
“”"
or some bad configuration on the Api of firebase?
Any help can be helpfull! Thank you!
i change from google chrome to Opera browser and yes is return the popup to activate notification, but on console is not print the token, or what can be the best approch to store it on the datatable?
I find the issue it was something on server side of main app, i clean all and now is fixed and the funtion device_token return correctly the string of token!Thank you @divyeshlakhotia
Now i will go for next step call the push_notifications.send(device_token,‘Title’,‘Body’,‘Logo’,‘Link’)
it can be possible to send something like this:
push_notifications.send(device_token,‘Title’,‘Body’,‘’,‘’) without link and logo ?
Thank you!
Hello, here again
I’m trying to call the function on my VPS :
from Push_Notifications import push_notifications
push_notifications.send(device_token,'Title','Body','Logo','Link')
when i run it is ask me the module push_notifications is not define, im trying to connect the dependency with the uplink and i do try with uplink of main app too.
There is some way to call correctly the module to make the func. push_notifications.send work and triggered when is find condition on my vps
Since you don’t have the push_notifications module in your local machine, it will not work. However, you can manually add the function to your machine from the push notifications dependency.