I'm trying to implement the new notification runtime permission introduced in Android 13.
I have noticed that the code requires implementation also of shouldShowRequestPermissionRationale. However is not clear when this function returns true in order to show an educational ui.
Can you help me to understand?
If user has already blocked it from Settings shouldShowRequestPermissionRationale() returns false. So there is no need to show an educational UI and request for permission. In that case the user can open notifications from settings only.
Related
I'm using the following plugin for implementing and handling FCM push notifications in my xamarin application and there's one little unaddressed problem I'm facing.
I was hoping someone else has already figured it out and could help me.
THE PROBLEM:
It seems to be duplicating my MainActivity although I have the LaunchMode set to SingleTop.
There's an event called OnNotificationReceived that's provided by the library.
This event fires as expected, only once, when the application is in the foreground.
When I minimize the application (let it run in the background), send a notification to the device and tap on the notification, it opens the application, as expected, but if I send another notification after that, while the application is in the foreground, The OnNotificationReceived Event is fired twice.
I've tried changing the NotificationActivityFlags property to SingleTop.
I've tried changing my MainActivity's Launch Mode to SingleTop
I tried running the sample application they've provided to check if its something that I'm doing wrong, and still the same thing happens.
Logging the issue in their Github repository
None of the above have worked.
The issue can be reproduced by:
downloading the sample from the repository, link provided above
replacing their google-services.json file with your own from the Firebase
console.
change the package name of the sample of the application to the one you
have registered on Firebase
following the steps above that I've mentioned
ADDITIONAL INFO
Version Number of Plugin: 1.3.0
Device Tested On: Huawei P8 Lite Android Version 6.0
Version of VS: Visual Studio 2019
Version of Xamarin: 3.4.0.1009999
Update:
Unfortunately, the method below has not proven successful after attempting to implement it, I should have thought of the fact that I'm still going to need the notification object for iOS, earlier.
Myself and the team are going to implement a way to keep track of the users platform on the server and send them a notification either with or without the notification based on their platform, since iOS handles FCM notifications differently from Android. For now we're going to use Google's Instance ID service to determine what platform existing users are on.
Workaround:
I hope this helps someone in the future, if not I hope someone can provide me with a better solution.
In order to have my cake and eat it, basically be able to keep the notification object in the payload instead of removing it and having to further customise the payload to display notifications just for iOS, I changed the MainActivity's (the activity thats launched when a user taps on the notification) Launch mode to SingleInstance. That way I can keep my notification object in the payload and not have to worry about the OnNotificationReceived event being triggered twice.
I am using OneSignal in my Flutter application to receive notifications. I have created my own table within Flutter to save notifications but I cannot save messages that have been sent whilst the app has been terminated. However, I have found that the OneSignal package has it's own database installed on the device which captures everything no matter what state the application is in! So, to avoid duplicating data I want to use this database instead. It is located outside of the flutter app folder which is my issue (see image below).
How do I access this database? Does anybody know if it is the same on iOS (I haven't been able to check at this time).
Many thanks.
It's important to understand that if an app has been terminated, any onReceived handler will not be fired. We don't recommend using the local db at all. Your best bet is to use the respective notification extender services for each platform. Though you will have to write native code for this! Cheers
Edit:
ANDROID - NotificationExtenderService - This can be setup to receive silent notifications when your app is not running or to override how notifications are shown in the notification shade. See the Background Data and Notification Overriding section to set this up.
I'm currently running an A/B test on a remote config value in Firebase. The target of the test is for users with a user property X that is contained in a regex.
My problem is that I fetch the remote configs for the user BEFORE setting the user property, so I need to update the remote config when the user property is set. So basically, a force update of a remote config (that is updated because the user is now part of the AB test).
Any ideas?
This article will help you.
Force your users to update your app with using firebase
This code will set app to fetch every minutes.
firebaseRemoteConfig.fetch(60)
But this method does not force update app.
So, I suggest you to all server APIs implement the functionality to do version checking. For example, if your app version was updated, all of APIs will return "You need to update your app" error.
Be careful with Firebase updates on both: iOS and Android. You can read more about it here: https://medium.com/#elye.project/be-careful-when-using-firebase-remote-config-control-for-pre-announced-feature-52f6dd4ecc18
On iOS config can be force updated with following code:
config.fetch(withExpirationDuration: 0, completionHandler: fetchCompletion)
I'm actually implementing the push notification (https://developers.google.com/actions/assistant/updates/notifications) and I'm not sure to understand everything.
I'm using dialogflow through webhook json with php webservices, and meant to be used with google home (and phone).
All my tests are done through simulator.
I've created an intent get_store
I've created 2 implicits intents (notification_store and notification_text) and activated them as notification in the action console.
When I go into get_store, i'm asking a permission to send notification for notification_store (to send a gmap link), when the user respond yes, it returns me an UPDATES_USER_ID and set the user permission as true in all next requests.
Then, I use this UPDATES_USER_ID and the get_store to send the notification (it responds with a 200 ok)
Questions :
- Once I've accepted the permission, it will not ask me any new permission, even if I want to send notification for notification_text, which means it's one update permission for all notifications intents?
- I can't delete UpdatePermission from my user, even after using reset button or change version
- I have a doubt, does it work only with a released version (alpha/beta/prod) or even with a draft?
If someone can help me to understand what's possible so I could be able to know what is working, not working, not possible.
Thanks.
When you ask for permission to send push notifications, the UPDATE permission gets cached so you don't have to repeatedly ask the user for permission. However this permission is unique to the intent specified when asking for permission.
When asking for a user's permission to send push notifications, you must specify the implicit intent you are asking permission for. So in get_store, I imagine this intent is set to notification_store.
The following code uses the Node.js client library, but the concept is the same:
app.intent('get_store', (conv) => {
conv.ask(new UpdatePermission({intent: 'notification_store'}));
});
Because of this, you can't use get_store to ask for permission for notification_text. Instead you will need to create a separate intent such as get_text, which specifically asks for permission to send push notifications for notification_text.
Firebase Crashlytics has a feature for customizing crash reports. In my case, I'm reporting the internal user ID so that I can pull up more information to debug the issue.
I'm not able to see the user ID anywhere in the Firebase Crashlytics tab.
I call this in
Application.onCreate()
Crashlytics.setUserIdentifier(uid);
You can see it here:
Or try to search reports by user ID here:
If the search result is empty, it means your "test crash" hasn't synced yet.
You don't see the user ID in Firebase Crashlytics because you are not calling the correct method.
Here is how to do it:
FirebaseCrashlytics.getInstance().setUserId("12345");
In addition, you can give yourself more context for the events leading up to a crash by logging custom message:
FirebaseCrashlytics.getInstance().log("Higgs-Boson detected! Bailing out");
For more infos:
https://firebase.google.com/docs/crashlytics/customize-crash-reports?authuser=0&platform=android#set_user_ids
Add FirebaseCrashlytics.getInstance().setUserId(uuid);
in all screens (activities). If you add only in login screen then userid will not share to crashlytics, when app is crashed after reopening. Since we will ask user to login only once.