Web Push Notification #
- Create your own firebase Web app from https://console.firebase.google.com with your own web domain/any name.
- Generate key pair from under Project Setting->Web configuration.
- Select The Web App from Project Setting->General->Web apps, and you will find SDK setup and configuration section
- Select Config and copy Firebase configuration object
- Go to
<project>/web/index.html
and set firebaseConfig with the Firebase configuration object value.
/web/index.html
var firebaseConfig = {
apiKey: "AIzaSyB4NEjiBYcHAbtz2Hy4dc8L7xyngnQQrG4",
authDomain: "grofresh-web-test.firebaseapp.com",
projectId: "grofresh-web-test",
storageBucket: "grofresh-web-test.appspot.com",
messagingSenderId: "536310321033",
appId: "1:536310321031:web:a4de7b7eae799c9c0d22",
measurementId: "536310321034",
};
- Also go to
<project>/lib/main.dart
and change the FirebaseOptions argument value with the Firebase configuration object value.
/lib/main.dart
await Firebase.initializeApp(options: FirebaseOptions(
apiKey: "AIzaSyB4NEjiBYcHAbtz2Hy4dc8L7xyngnQQrG4",
authDomain: "grofresh-web-test.firebaseapp.com",
projectId: "grofresh-web-test",
storageBucket: "grofresh-web-test.appspot.com",
messagingSenderId: "536310321033",
appId: "1:536310321031:web:a4de7b7eae799c9c0d22",
measurementId: "536310321034",
));
Tip
You can find the video tutorials here
Web Push Notification Sound Customization #
If you want to change the default notification sound of the web then go to <project>/assets/notification.wav
and rand replace notification.wav with your own notification.wav
Facebook Login #
- If you want Facebook login in your project then create your own app form https://developers.facebook.com/apps
- Configure your app form Settings->Basic with your own Display name, Contact email, Privacy Policy URL, Terms of Service URL, App icon
- Add your platform (
web/android/ios
) with click Add platform and configure your app. - Add Facebook Login form products section.
- To Configuration settings in App->Facebook Login->Settings->Client OAuth settings enable Client OAuth login, Web OAuth login, Enforce HTTPS, Use Strict Mode for redirect URIs, Login with the JavaScript SDK.
- Also, you need to add your Allowed Domains for the JavaScript SDK (ex- https://grofresh-web.6amtech.com)
- To get profile information you need to request access in App Review->Permissions and features get access for public_profile
- Now open your flutter project go to
<project>/lib/main.dart
and replace with your Facebook appID - For android go to
<project>/android/app/src/main/res/values/string.xml
and set value.
/android/app/src/main/res/values/
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">GroFresh</string>
<string name="facebook_app_id">YOUR_APP_ID</string>
<string name="fb_login_protocol_scheme">fb_YOUR_APP_ID</string>
<string name="facebook_client_token">Go_to_your_fb_app->Settings->Advance->Security->Client token</string>
</resources>
- For ios go to
ios/Runner/Info.plist
and set value
ios/Runner/Info.plist
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>fb_your_app_id</string>
</array>
</dict>
<array>
<key>FacebookAppID</key>
<string>app_id</string>
<key>FacebookClientToken</key>
<string>
Go_to_your_fb_app->Settings->Advance->Security->Client token
</string>
<key>FacebookDisplayName</key>
<string>name</string>
- For web go to
<project>/lib/main.dart
set your appID.
/lib/main.dart
await FacebookAuth.instance.webAndDesktopInitialize(
appId: "YOUR_FB_APP_ID",
cookie: true,
xfbml: true,
version: "v13.0",
);
Tip
You can find the video tutorials here
Google Login #
- If you want to enable your Google login then go to https://console.firebase.google.com and open your Project->Authentication->Sign-in method-> Add new Provider->Additional providers then select Google and enable finlay Save.
- For Android, you need to set fingerprint in Project->Project settings-> Android apps-> add fingerprint then enter your SHA1 and SHA256 and Save.
- After published on playscape you need to add your SHA1 and SHA256 form App integrity.
- To find App integrity App signing, go to Google Play Console Project-> Release-> Setup-> App integrity-> App signing
- Download your Google service and Copy that file and paste it under
<project>/android/app/
folder.
- Go to https://console.cloud.google.com and select your firebase project, you can find your Client id in, APIs & Services-> Credentials -> OAuth 2.0 Client IDs then select Web Client and finally copy the Client ID.
- For ios go to
<project>/ios/Runner/Info.plist
and add your Client ID
/ios/Runner/Info.plist
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLSchemes</key>
<array>
<string>YOUR_CLIENT_ID</string>
</array>
</dict>
- For web go to
<project>/web/index.html
and set your CLIENT_ID
/web/index.html
<meta name="google-signin-client_id" content="YOUR_CLIENT_ID">
Tip
You can find the video tutorials here