I’m trying to subscribe myself to onesignal using a simple python flask app in my local machine. I have the pop up that asks me if I want to subscribe and then the browser asks me if I want to allow notifications (which I click “allow”). Then, I check the OneSignal dashboard and I can’t find my device subscribed (the count is always 0).
What I’m doing wrong?
This is my app structure:
/my_project
/templates
index.html
/static
OneSignalSDKWorker.js
app.py
This is my app.py:
from flask import Flask, render_template
app = Flask(__name__)
@app.route('/')
def home():
return render_template('index.html')
if __name__ == '__main__':
app.run(host='0.0.0.0', port=6868,debug=True)
And this is index.html:
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>OneSignal Test</title>
<script src="https://cdn.onesignal.com/sdks/web/v16/OneSignalSDK.page.js" defer></script>
<script>
window.OneSignalDeferred = window.OneSignalDeferred || [];
OneSignalDeferred.push(function (OneSignal) {
OneSignal.init({
appId: "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
allowLocalhostAsSecureOrigin: true
});
});
</script>
</head>
</html>