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

Google Maps location information sharing page settings button click n… #2634

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions play-services-core/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -764,6 +764,10 @@
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
<intent-filter>
<action android:name="com.google.android.gms.location.settings.LOCATION_SHARING"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>

<activity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ private val ACTION_TO_SCREEN_ID = hashMapOf(
ACTION_ACCOUNT_PREFERENCES_SETTINGS to 1,
ACTION_SECURITY_SETTINGS to 10006,
ACTION_PRIVACY_SETTINGS to 10004,
ACTION_LOCATION_SHARING to 210,
)

class MainActivity : AppCompatActivity() {
Expand All @@ -134,7 +135,7 @@ class MainActivity : AppCompatActivity() {
Log.d(TAG, "Invoked with ${intent.action} and extras $extras")
super.onCreate(savedInstanceState)

val screenId = intent?.getIntExtra(EXTRA_SCREEN_ID, -1).takeIf { it != -1 } ?: ACTION_TO_SCREEN_ID[intent.action] ?: 1
val screenId = ACTION_TO_SCREEN_ID[intent.action] ?: intent?.getIntExtra(EXTRA_SCREEN_ID, -1).takeIf { it != -1 } ?: 1
Copy link
Member

Choose a reason for hiding this comment

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

What is the screen id sent by Google Maps? Giving priority to the action-based screen id will mean that we might not show the appropriate screen in some cases, so maybe there's a better way to handle this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

screen id is 1

Copy link
Member

@ale5000-git ale5000-git Nov 24, 2024

Choose a reason for hiding this comment

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

I don't know if 0 is a valid screen id but in case it isn't valid you can also change to:
val screenId = intent?.getIntExtra(EXTRA_SCREEN_ID, -1).takeIf { it > 1 } ?: ACTION_TO_SCREEN_ID[intent.action] ?: 1

So if the screen id is -1, 0, 1 it prefer action otherwise it use the screen id.

I haven't tried, just an idea.

val product = intent?.getStringExtra(EXTRA_SCREEN_MY_ACTIVITY_PRODUCT)
val kidOnboardingParams = intent?.getStringExtra(EXTRA_SCREEN_KID_ONBOARDING_PARAMS)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const val ACTION_MY_ACCOUNT = "com.google.android.gms.accountsettings.MY_ACCOUNT
const val ACTION_ACCOUNT_PREFERENCES_SETTINGS = "com.google.android.gms.accountsettings.ACCOUNT_PREFERENCES_SETTINGS"
const val ACTION_PRIVACY_SETTINGS = "com.google.android.gms.accountsettings.PRIVACY_SETTINGS"
const val ACTION_SECURITY_SETTINGS = "com.google.android.gms.accountsettings.SECURITY_SETTINGS"
const val ACTION_LOCATION_SHARING = "com.google.android.gms.location.settings.LOCATION_SHARING"

const val EXTRA_CALLING_PACKAGE_NAME = "extra.callingPackageName"
const val EXTRA_IGNORE_ACCOUNT = "extra.ignoreAccount"
Expand Down