aws-amplify / amplify-android

The fastest and easiest way to use AWS from your Android app.
https://docs.amplify.aws/lib/q/platform/android/
Apache License 2.0
246 stars 115 forks source link

Developer Menu can't be disabled in Debug Mode #800

Closed estiukamobi closed 4 years ago

estiukamobi commented 4 years ago

When integrating 'com.amplifyframework:aws-auth-cognito:1.3.1' I have noticed that a Developer Menu Screen has been introduced when the application is in Debug mode. It appears if the device is shaken.

However, the developer Menu is enabled by default and cannot be disabled, also the shake detector is way too sensitive https://github.com/aws-amplify/amplify-android/blob/f345bda690eec84d5e83fecb4efba7e50bcf8c11/core/src/main/java/com/amplifyframework/core/Amplify.java#L145

cr7ritesh commented 4 years ago

I am also facing the same issue. I don't really want my app to show the DeveloperMenu to the users...

KayIlory commented 4 years ago

I am also facing the same issues. Anyway to disable this image

jpignata commented 4 years ago

Howdy! That will only show up in debug mode. We'll circle back next week on an option to disable and tweaks to the shake sensitivity.

24Lathiya commented 4 years ago

@estiukamobi Android application generating two app shortcuts with same icon and name. One is opening app were another open menu like KayIlory's Issue In my case it is not disable in release mode too. Please help @jamesonwilliams

jpignata commented 4 years ago

Heya @24Lathiya -- are you seeing this behavior with our 1.3.1 release?

24Lathiya commented 4 years ago

@jpignata OMG this issue gone with 1.3.1 thanks.

jamesonwilliams commented 4 years ago

Resolving as per https://github.com/aws-amplify/amplify-android/issues/800#issuecomment-688847165

jpignata commented 4 years ago

I think we should discuss two items:

1) Do we have an option to disable this functionality in debug? 2) Should we tweak the sensitivity?

richardmcclellan commented 4 years ago

Here is the ReactNative ShakeDetector implementation, that is used for showing the ReactNative debug menu. Copying the sensitivity values would probably make sense. The comments indicate they only trigger on detecting a "rage shake". 😂

kwatkins commented 4 years ago

This is still in 1.3.1... And bad form adding without a disable flag, it's super annoying.

jpignata commented 4 years ago

@kwatkins Got it. We'll make a fix right away for the next release to reduce the sensitivity and add a flag to disable.

jamesonwilliams commented 4 years ago

821 went out in the 1.3.2 release.

mihirap commented 3 years ago

1.3.1, 1.3.2, 1.4.1 I checked with these versions. But can't disable it.

richardmcclellan commented 3 years ago

Hi @mihirap,

You should be able to disable the debug menu in 1.3.2 and above by passing a custom AmplifyConfiguration to Amplify.configure() like this:

val config = AmplifyConfiguration.builder(applicationContext)
    .devMenuEnabled(false)
    .build()
Amplify.configure(config)
simondorociak commented 3 years ago

Hi @mihirap,

You should be able to disable the debug menu in 1.3.2 and above by passing a custom AmplifyConfiguration to Amplify.configure() like this:

val config = AmplifyConfiguration.builder(applicationContext)
    .devMenuEnabled(false)
    .build()
Amplify.configure(config)

It works. Thanks.

akshathaphalady commented 3 years ago

Hi @richardmcclellan I'm facing same issue in my flutter application. Is there any solution for that?

jamesonwilliams commented 3 years ago

Hi @richardmcclellan I'm facing same issue in my flutter application. Is there any solution for that?

We should just disable the dev menu entirely in Flutter right now. https://github.com/aws-amplify/amplify-flutter/pull/266

The feature can be added to Flutter in a more controlled manner. There will need to be some supporting work in the Dart layer.

photizzo commented 3 years ago

To follow up on @mihirap comment. In the most recent version you need to supply the application context as one of its arguments


Amplify.addPlugin(AWSCognitoAuthPlugin())
            Amplify.addPlugin(AWSS3StoragePlugin())
            val config = AmplifyConfiguration.builder(applicationContext)
                .devMenuEnabled(false)
                .build()
            Amplify.configure(config, applicationContext
richardmcclellan commented 3 years ago

FYI, we recently changed (https://github.com/aws-amplify/amplify-android/pull/1167) the developer menu to be disabled by default, so if you don't want to use the developer menu, you no longer need to explicitly disable it, as mentioned above.

To use Amplify without the developer menu:

Amplify.configure(applicationContext)

To enable the developer menu:

val config = AmplifyConfiguration.builder(applicationContext)
    .devMenuEnabled(true)
    .build()
Amplify.configure(config, applicationContext)
mertoenjosh commented 1 year ago

How do I disable it if using amplifyconfiguration.json. Is there a block I need in the file. This is how I am initializing it.

Amplify.addPlugin(AWSCognitoAuthPlugin())
Amplify.addPlugin(AWSS3StoragePlugin())
Amplify.configure(
    AmplifyConfiguration
        .fromConfigFile(
            applicationContext,
             R.raw.amplifyconfiguration
         ), applicationContext
)
tylerjroach commented 1 year ago

@mertoenjosh The dev menu does not get enabled/disabled from the json configuration file. However, with the example shown, it should not be enabled by default. You would have to explicitly add .devMenuEnabled(true) to enable it.

mertoenjosh commented 1 year ago

@tylerjroach I haven't enabled it explicitly in my code. Amplify version 1.6.4.

eeatonaws commented 1 year ago

As of Amplify Android 1.16.13, the developer menu is disabled by default. Prior to version 1.16.13, the developer menu is enabled by default and .devMenuEnabled(false) can be added to disable the developer menu.

mertoenjosh commented 1 year ago

The function .fromConfigFile(appCxt, R.raw.amplifyconfiguration) returns the configuration not a builder hence adding .devMenuEnabled(false) is not possible. Using a builder allows me to call 'devMenuEnabled(false)`. Thanks for your responses @tylerjroach and @eeatonaws.

This is how I am initializing it now. It works.

val config = AmplifyConfiguration
    .builder(applicationContext, R.raw.amplifyconfiguration)
    .devMenuEnabled(false)
    .build()

Amplify.addPlugin(AWSCognitoAuthPlugin())
Amplify.addPlugin(AWSS3StoragePlugin())
Amplify.configure(config, applicationContext)