5. Versuch Bugfix "beannnte App" in Firebase
This commit is contained in:
1 parent
572a881f72
commit
94d8db2e7c
2 files changed
+15
-4
No files matched your search
@@ -260,7 +260,7 @@ class FcmService:
|
||||
for start in range(0, len(tokens), 500):
|
||||
batch = tokens[start:start + 500]
|
||||
batch_result = self._send_batch(
|
||||
messaging, batch, data, android, webpush
|
||||
messaging, batch, data, android, webpush, app=app
|
||||
)
|
||||
result['sent'] += batch_result['sent']
|
||||
result['failed'] += batch_result['failed']
|
||||
@@ -272,7 +272,7 @@ class FcmService:
|
||||
|
||||
return result
|
||||
|
||||
def _send_batch(self, messaging, tokens, data, android, webpush):
|
||||
def _send_batch(self, messaging, tokens, data, android, webpush, app=None):
|
||||
batch_result = {
|
||||
'sent': 0,
|
||||
'failed': 0,
|
||||
@@ -287,7 +287,12 @@ class FcmService:
|
||||
webpush=webpush,
|
||||
)
|
||||
try:
|
||||
response = messaging.send_each_for_multicast(message)
|
||||
# Der Dienst initialisiert bewusst eine benannte App ("cmbnet"),
|
||||
# damit er sich nicht mit einer eventuell vorhandenen
|
||||
# Standard-App anderer Module vermischt. Die messaging-Funktionen
|
||||
# verwenden ohne ``app`` jedoch immer die Standard-App und würden
|
||||
# deshalb mit "The default Firebase app does not exist" scheitern.
|
||||
response = messaging.send_each_for_multicast(message, app=app)
|
||||
responses = list(response.responses)
|
||||
except Exception as exc:
|
||||
details = self._describe_send_error(None, exc)
|
||||
|
||||
Reference in new issue
Block a user