fossasia / susi_android

SUSI.AI Android App https://play.google.com/apps/testing/ai.susi
Apache License 2.0
2.42k stars 1.11k forks source link

Hotword detection toast keeps on popping up more than once #1005

Closed 97k closed 7 years ago

97k commented 7 years ago

Actual Behaviour

In my device(emulator), hotword detection toast is coming, each time when redirecting to the ChatActivity, though user is running the app.

Expected Behaviour

Toast should only come once, only when the user open-up the app

Steps to reproduce it

In an emulator device, run the app, redirect to any other activity, and when you come back to ChatActivity, toast will be shown again.

Screenshots of the issue

giphy

Would you like to work on the issue?

Yes, @chiragw15 @iamareebjamal is this a valid issue?

yashLadha commented 7 years ago

Are you using an emulator or a device. Check the microphone settings for the app. @aditya98ak

yashLadha commented 7 years ago

Oh sorry my bad..In emulator microphone is not detected automatically. It is not using your laptop microphone. So you have to alter settings of emulator to use a microphone or use a virtual microphone.

97k commented 7 years ago

@yashLadha But don't you think it is a valid issue, though it is not using microphone but toast message should not be shown so many times? What do you say? or should I close this issue?

yashLadha commented 7 years ago

See it is because whenever activity comes it calls on create method and in that there is a function call initializeMethod which takes places and produces the toast message (actually inside of that is another call to produce toast message). Instead of every time producing the toast we can generate it once but due to some error the microphone is disconnected for some time and them get connected so the user should also get notified about it too. We can take this discussion on gitter for getting views of everyone.

97k commented 7 years ago

@yashLadha Yes, sure :+1:

chiragw15 commented 7 years ago

We could show two different toasts, one can be displayed if hotword detection is not supported by phone, other can be if some error occurred during hotword detection like microphone disconnected or something like that. What say @yashLadha @aditya98ak ?

97k commented 7 years ago

I agree with you @chiragw15 and also a toast if microphone gets connected again, as @yashLadha said.

yashLadha commented 7 years ago

Yes, it would be great @chiragw15 , @aditya98ak go ahead with the PR.

97k commented 7 years ago

Toast for hotword detection like microphone disconnected is ok, but for showing toast I am stuck Acc to me we can do two things here.

  1. Show a toast("Hotword detection is not supported") only for once per lifetime, till the data is not cleared.
  2. For this point please have a look at this link. https://stackoverflow.com/questions/7360846/how-can-i-execute-something-just-once-per-application-start @chiragw15 @yashLadha What are your views?
collinx commented 7 years ago

@aditya98ak We are already using shared preferences, so it would be great if you implement using that to trigger first-time toast. 😄

97k commented 7 years ago

@collinx I was just confirming, Okay then, sending the PR soon :smile: