Skip to content

feat(device_info_plus): Add User Device Name in Android #3437

Closed
FaizanUllahDev wants to merge 0 commit intofluttercommunity:mainfrom
FaizanUllahDev:main
Closed

feat(device_info_plus): Add User Device Name in Android #3437
FaizanUllahDev wants to merge 0 commit intofluttercommunity:mainfrom
FaizanUllahDev:main

Conversation

@FaizanUllahDev
Copy link
Copy Markdown
Contributor

@FaizanUllahDev FaizanUllahDev commented Jan 20, 2025

Description

This PR updates the functionality of the NAME property to now include and send the customer's device name. This enhancement ensures that the application can capture and utilize the user device name for better identification, personalization, and debugging. Prior to this change, the NAME property did not include device-specific details. This update significantly improves logging, user tracking, and system behavior analysis.

Related Issues

In the current package, the user is unable to obtain the Android user's custom device name

Checklist

Breaking Change

Does your PR require plugin users to manually update their apps to accommodate your change?

@FaizanUllahDev FaizanUllahDev changed the title Add User Device Name in Android feat: Add User Device Name in Android Jan 20, 2025
@FaizanUllahDev FaizanUllahDev marked this pull request as draft January 20, 2025 16:22
@FaizanUllahDev FaizanUllahDev marked this pull request as ready for review January 20, 2025 16:24
@FaizanUllahDev
Copy link
Copy Markdown
Contributor Author

Need Manual Testing

@miquelbeltran
Copy link
Copy Markdown
Member

Hello, can you fix the markdown of the PR description, as well as adding the plugin name between ( ) on the PR title?

The feature seems good to me, I'll take a deeper look when I got the time.

@FaizanUllahDev FaizanUllahDev changed the title feat: Add User Device Name in Android feat: Add User Device Name in Android (device_info_plus) Jan 21, 2025
@miquelbeltran
Copy link
Copy Markdown
Member

The title format is still not right, please read the contributor guidelines and look at other PRs on how it is done

@FaizanUllahDev FaizanUllahDev changed the title feat: Add User Device Name in Android (device_info_plus) feat(device_info_plus)!: Add User Device Name in Android Jan 21, 2025
@FaizanUllahDev
Copy link
Copy Markdown
Contributor Author

Check Now

@miquelbeltran
Copy link
Copy Markdown
Member

thanks, although I don't think this is a breaking change

@miquelbeltran miquelbeltran changed the title feat(device_info_plus)!: Add User Device Name in Android feat(device_info_plus): Add User Device Name in Android Jan 21, 2025
@FaizanUllahDev
Copy link
Copy Markdown
Contributor Author

Yes! but this change will save the time and give possibles user name of the current user device.

@miquelbeltran miquelbeltran self-assigned this Jan 28, 2025
@miquelbeltran
Copy link
Copy Markdown
Member

I've been working today on this PR and found several things that need changes, however when I tried to push my changes I've got remote rejected. Can you enable that we can push to your branch?

val handler = MethodCallHandlerImpl(packageManager, activityManager)
val activityManager: ActivityManager =
context.getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager
val handler = MethodCallHandlerImpl(packageManager, activityManager, context)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't pass context here, instead pass the ContentResolver.

build["manufacturer"] = Build.MANUFACTURER
build["model"] = Build.MODEL
build["product"] = Build.PRODUCT
build["name"] = Settings.Global.getString(context.contentResolver, Settings.Global.DEVICE_NAME)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This API is only available from Android N (API 25), this code needs to check for the version. Android Studio should show a warning.

final String product;

/// The name of the device.
/// https://developer.android.com/reference/android/os/Build#NAME
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this documentation is incorrect, it should link to https://developer.android.com/reference/android/provider/Settings.Global#DEVICE_NAME

@FaizanUllahDev
Copy link
Copy Markdown
Contributor Author

I've been working today on this PR and found several things that need changes, however when I tried to push my changes I've got remote rejected. Can you enable that we can push to your branch?

Please check now I set the bypass rule for the update

@miquelbeltran
Copy link
Copy Markdown
Member

It won't let me push, probably because the PR was created from main instead of a branch? anyway I added comments on what needs to be changed

@FaizanUllahDev
Copy link
Copy Markdown
Contributor Author

It won't let me push, probably because the PR was created from main instead of a branch? anyway I added comments on what needs to be changed

I added you as contributor so, I think now you can do changes

@miquelbeltran
Copy link
Copy Markdown
Member

ugh what just happened, I pushed and it closed the PR?

@miquelbeltran
Copy link
Copy Markdown
Member

Reopening

@miquelbeltran
Copy link
Copy Markdown
Member

Well, I don't know. Git is giving me lots of problems, opening a pr from main directly can cause issues. I pushed the code on a new branch in your repo. Create a new PR following this link: https://github.com/fluttercommunity/plus_plugins/compare/main...FaizanUllahDev:plus_plugins:3437?expand=1 and copy the description from this PR.

miquelbeltran added a commit that referenced this pull request Feb 4, 2025
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 5, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Request]: User Defined Device Name [ Android ]

2 participants