I'm working on my project and making an android app using Cognito for user management.
I tried to use it as user database so I made some custom fields like age and picture_url. But I cannot find a way to change the value of a custom field. I found the code to delete the value of field but couldn't find the one to register to an existing user.
Is it impossible to change the value of a custom field from android or lambda in python so that I need to switch to RDS to store user information?
The Python SDK method which should work for this is CognitoIdentityProvider.Client.update_user_attributes (Python SDK AWS Docs)
For the attribute name be sure to prefix it with custom: (custom:age and custom:picture_url for the attributes you mentioned). The custom prefix is mentioned here: AWS Docs: Configuring User Pool Attributes
If you are using Client based access be sure the Client has access to modify the custom attributes. I don't believe clients which exist prior to the custom attribute being created automatically have access to modify the newly created attribute.
Related
I try to init Firebase depending on a user language preferences.
For example:
User open an app.
Select language A: Flutter should init project A (config, etc.).
Similarly when the user selects a different language.
The problem is that iOS needs to have default GoogleService-Info.plist file.
During the dynamic init of a Firebase there is created an app but the default one is from the default file and takes the priority over project A. Ultimately, two applications are created (DEFAULT and A). This causes that FirebaseMessaging is assigned to the default Firebase app instead of the second one based on a user preference.
According to the messaging.dart docs:
/// If [app] is not provided, the default Firebase app will be used.
// TODO: messaging does not yet support multiple Firebase Apps. Default app only.
In that case there is no possibility to support dynamic init of a Firebase config file due to the fact that there will be always a default app initiated from the default config file.
In native apps I can create many .plist files and invoke FirebaseApp.configure(options: options)
Do you have any idea how to solve this problem in Flutter?
The problem you are experiencing with FirebaseMessaging is a result of the firebase_messaging package not yet supporting .instanceFor(). The presence of the default app would not be an issue otherwise, but the default app is hard coded to be the only supported app in FirebaseMessaging.
Support for .instanceFor() has already been added to the FirebaseAuth, FirebaseFirestore and FirebaseStorage packages. If FirebaseMessaging
supported instanceFor(), you could simply pass your secondary app name in and reference it using that method. Instead, the lack of support in that package adds needless complication. More info on instances here: https://firebase.flutter.dev/docs/core/usage/#secondary-firebase-apps.
Further information pertaining to the lack of multi-app support in fcm can be found here: https://github.com/FirebaseExtended/flutterfire/issues/5844. There is mention of a possible workaround (which I have not personally attempted) and also an open PR at https://github.com/FirebaseExtended/flutterfire/pull/6549 which is still in the draft stage.
You may be able to accomplish the desired functionality using flavors but I am not familiar enough with them to assist on that topic: https://flutter.dev/docs/deployment/flavors.
I was in the same situation and opted to subscribe all app users to the default app instance and in turn perform all fcm dispatching via firebase cloud function on behalf of my default project, until the firebase_messaging package team fixes this obvious hole in their implementation.
If you have the ability to contain all your data in a single project, organized by language collections and isolated by rules you may want to consider that an option as well.
I am using Firebase Remote Config feature to fetch some parameters required by the application. The parameter values depends on the userProperty which I have defined in the user properties tab in the Analytics section in Firebase.
Now, I want to get the parameter value for which the particular user property is true. I have defined condition using that user property. For example, lets say that the user property screen_size is what I have a defined condition for, such as if screen_size matches AxB then set a parameter named mqtt_chat_enabled to true and the default value is false.
When I fetch the remote config, I am getting the default value of mqtt_chat_enabled even if the screen_size is AxB.
The question is, how do we send the condition parameters when fetching the remoteConfig?
I tried using setUserProperties method before fetching remoteConfig, but it's not working.
I am not getting anything for this on the web. Please help.
I was also facing the same problem. It turns out be issue with the firebase version. Upgrade your google play services and latest version of firebase, it should work then.
I am using firebase version 10.2.0
I know I have set a company domain when I created the project, but how can I get the domain name as a String from code? This is useful because I'm writing a library project and one of the features requires to collect apps(apps using my library)'s company domains.
I did set "Company Domain" when I create a new project with Android Studio:
I understand I can get the package name and/or application ID, but that's not what I want. I want to get the "Company Domain" as mentioned above (maybe it's not required during project creation, but if it is set, can I get it from code?).
I have set a company domain when I created the project
No, you set a package name/application ID when creating the project. While using a reverse domain name is a typical approach for getting a likely-to-be-unique application ID, it is not a requirement.
how can I get the domain name as a String from code?
You are welcome to call getPackageName() on a Context to retrieve the application ID associated with the application. Again, this may or may not have any resemblance to a domain name. There is no requirement that Android developers provide a domain name as part of their apps.
one of the feature requires to collect apps(apps using my library)'s company domains
I trust that you will only do this with full disclosure to the developers using the library.
I did set "Company Domain" when I create a new project with Android Studio
That is in Android Studio. That is not in Android. That field is only used to suggest an application ID. It is not stored as part of your project, and it is not available at runtime.
I want to get the the "Company Domain" as mentioned above
Then you will need to have some sort of API in your library where developers supply a domain name.
but if it is set, can I get it from code?
No.
I am trying to check if an username is unique in the Installation class of my Parse collection. I figured out that the installation class cannot be queried like the normal classes and should be cloud coded to obtain result.
I had seen this post. How to check Unique fields in a class using cloud code. I don't know how to replace this with what I require and make a call from my android device.
My requirement is that, I just need to check if a given username is already present in the Installation class or not.
Thanks in advance.
Best way is probably the one described in the post you linked to. You shouldn't try to determine the uniqueness of the name on the device - you should do it on the server side while creating a new instance of your installation class, and return an error to the app if it tries to create a username that already exists (like in the example you posted).
Is it possible to add custom field to some contacts, with custom mimetype (like facebook profile) without writing sync adapter, authenticator and sync service? I do not want to add "synchronization" functionality for my application.
After long research I think that I found an answer to this question.
There is no way of creating custom clickable and visible fields without writing some Synchronization service code, authenticator and syncAdapter.
Here is sample code which is adding new account to "Accounts and synchronization", and adding new contact with custom field, which can be viewed in some activity from current project:
https://github.com/nemezis/SampleContacts.
Android does support syncing custom fields 'out of the box' if you use Gmail.
You can use Gmail in the browser to add custom fields to any contact. This field will then sync to the phone.
However, to view or edit these on the phone, you will need to use some new applications.
I wrote an article that describes this process. Gmail's Contacts Custom Fields and Android.