Android: How to get company domain name from code - android

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.

Related

What is the purpose of organization name when we create a new flutter project?

What is the purpose of organization name when we create a new flutter project?
(Check the screenshoot)
This is called as Application ID in Android and Bundle ID in iOS. It is like a number place in a car, Play store and App Store indentifies application based on these ids. This is useful for OS to identify the application (To check app is installed or not etc). Also it is useful for security purposes like for Facebook Authantication and Firbase setup (To identify request is coming from right client). Please do not use example in your bundle id as with example play store will not allow your app to be released.
One more thing. Ideally bundle id should be in reverse company website domain.
Ex : If company website is www.mywebsite.com you should have your bundle id as com.mywebsite.app (.app is optional but it's a good practice to add app).
I hope this helps.
It is the unique id which playstore identifies the developer.
You can add you id as : for eg. com.company.app
user can identify your Application as uniquely in the play store and no other apps have same organization name

AWS Cognito: Change the value of users' custom field

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.

Hide Resource ID's from SDK

I have developed one SDK containig a layout with some sensitive input fields.
This SDK will be provided to third party App.
Everything is working fine.
Problem is,
I don't want third party App to fetch any of information from the input fields. But while using that SDK(.aar file) he can get the resource id's of those SDK input fields.
What can be done to prevent the resource id's from been exposed.
Code used in third party app to integrate the SDK,
Intent intent = new Intent();
intent.setComponent(new ComponentName("com.package_name", "com.package_name.class_name"));
startActivity(intent);
I don't want third party App to fetch any of information from the input fields
It is code in their app. They can get at whatever they want.
What can be done to prevent the resource id's from been exposed.
If by "exposed", you mean "available at compile time as simple R constants", you can whitelist the IDs that should be public, and the build tools will hide the remainder.
Note that this will not stop an interested party from accessing those fields from within their own process. It will merely add a few minutes to the development process.

How do I change my Application name

I would like to make a slight change to my application's name. I read that it can work if both applications are signed with the same signature and is given the same userId then they can share information and I can migrate the original application's information to the new one. It is very important that the user gets the notification to upgrade. Will the user receive the update to upgrade if its done this way?
Your users will still get the upgrade, as long as you don't change the top level java package name.
Do you mean the actual name (human readable) or the application package? You can change the name, description, etc. at any time (though it might be confusing for existing users). On the other hand, you cannot change the package name, you need to publish a new app. Unless the current app already has the sharedUserId, set you cannot really use that option: setting it will change the UID and the application won't be able to see its own files. Two solutions to this:
export the data in some shared format (XML, CSV, JSON, etc.)
write a content provider and use a signature permission to make sure only your apps can read from it.

How to use same ContentProvider authority in free and paid versions of app?

I've started using Android Library Projects to consolidate my paid and free version code.
I have run into a problem though with my ContentProvider. Since the ContentProvider is defined in the library class, both apps use the same authority. This means that android prevents the second app (in either order) from being installed due to an INSTALL_FAILED_CONFLICTING_PROVIDER error.
05-22 11:14:40.563: WARN/PackageManager(102): Can't install because provider name com.cfms.android.podcast (in package com.cfms.android.podcastlite) is already used by com.cfms.android.podcastpaid
05-22 11:14:40.563: WARN/PackageManager(102): Package couldn't be installed in /data/app/com.cfms.android.podcastlite-2.apk
How can I deal with this issue? Ideally I'd like the authorities to be the same for each app version, so I don't have to put in a bunch of exceptions in the common code library. If that is not possible, how should I go forward?
It's simply not possible to have two apps on the same device with different providers using the same authority.
http://hustleplay.wordpress.com/2010/02/28/android-install_failed_conflicting_provider/
android duplicate provider authority.
I would create a different string resource in each application, that is then passed to the library to create the provider with the appropriate authority.
Could you try something like this?
http://ncsoftworks.com/forums/discussion/6/sharedpreferences-between-applications
Also isn't the authority of a content provider just a private embedded linux folder name? And isn't a content provider just a SQLite database file inside that private folder?
And can't we share the same folder between applications as long as we sign both applications with the same key and the same application package name thereby creating a shared user id?
In any case, I'm just thinking out loud at this point. I'll have to experiment with this. I'm just posting this up to save myself some time in case someone finds the flaw in my assumptions (before I have time to do the experiment).
Note: I said application package name, not activity package name. As I understand it, Android applications usually contain two package names (although the Eclipse New project wizard usually labels both packages with the same name, thereby creating the impression that there is only one package name)

Categories

Resources