Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
wants to merge 0 commits into from

Conversation

FaizanUllahDev
Copy link
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
Contributor Author

Need Manual Testing

@miquelbeltran
Copy link
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
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
Contributor Author

Check Now

@miquelbeltran
Copy link
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
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
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
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.

@@ -37,6 +40,7 @@ internal class MethodCallHandlerImpl(
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
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.

@@ -89,6 +90,10 @@ class AndroidDeviceInfo extends BaseDeviceInfo {
/// https://developer.android.com/reference/android/os/Build#PRODUCT
final String product;

/// The name of the device.
/// https://developer.android.com/reference/android/os/Build#NAME
Copy link
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
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
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
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
Member

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

@miquelbeltran
Copy link
Member

Reopening

@miquelbeltran
Copy link
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Request]: User Defined Device Name [ Android ]
2 participants