Coder Social home page Coder Social logo

flutter_hardware_buttons's People

Contributors

eojine avatar giantsol avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

flutter_hardware_buttons's Issues

Detect volume raising and falling edge

would it be possible to emit an single event when volume button goes from not pressed to pressed (raising edge) and the way round (when a button goes from pressed to not pressed)? I am developing a stopwatch timer and it is important to catch the raising and fallinge edges.

Kotlin Migration

Hi,

Do you have the opportunity to upgrade the version of kotlin ?

The Android Gradle plugin supports only Kotlin Gradle plugin version 1.3.0 and higher.
The following dependencies do not satisfy the required version:
project ':hardware_buttons' -> org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.71

How to detect Longpress of hardware button

I’m trying to detect whether a user of my app is attempting to hard reboot their phone (iOS) in attempt to cheat the score in the app.
Once a long press is detected I will like to run some code. Is this possible?

[Android] 볼륨 업/다운 감지하는 로직에 의해 앱이 키보드를 못띄우는 현상

지금 안드로이드에서 딱히 방법이 없어서 꼼수로 보이지 않는 윈도우 뷰를 새로 만들어서 거기서 KeyEvent를 처리하도록 했는데요, 그러다보니 앱에서 키보드가 안나오는 버그가 있습니다 ㅋㅋㅋ
이 사람도 문제 자체는 다르지만 비슷하게 윈도우 뷰를 쓰는 방식을 한게 있는데, 아래 댓글로 "Brilliant! Thanks. One problem here is that soft keyboard cant be opened :(" 라고 하네요 ㅎ.ㅎ....

윈도우 뷰를 띄우지말고 다른 방식을 찾아봐야하나 해서 삽질을 꽤 많이 해봤는데 지금까지 알기로는 그냥 윈도우 뷰를 계속 쓰는게 나은거같고.
일단 삽질 결과 해결 방법은 찾은거같아서 풀리퀘 올릴게요.

하.. 근데 애초에 보이지않는 윈도우 뷰를 만든다는거 자체가 뭔가 불안하네요 ㅋㅋㅋㅋㅋ

Detect volume button other way

Hi,

Is it possible to otherwise detect volume button events on Android so you do not have to ask for permissions?

[https://github.com/manueldeveloper/cordova-plugin-volume-buttons/blob/master/src/android/VolumeButtonsListener.java](Cf plugin ionic )

How to convert swift functions to 4.0

Is there anyway to make this package compatible with swift 4.0?

I have very little knowledge of swift and struggling to find a way to update/change the functions to be compatible with 4.0

[iOS] 락버튼 감지

홈버튼을 감지할 때 사용하는 코드는 UIApplicationDidEnterBackground이다.
이는 앱 실행이 백그라운드로 간 후에 작동하는 코드인데,
락 버튼을 눌러 잠금상태에 들어갈때에도 감지한다.

이 상항에서

  1. 홈버튼 코드 다른 방법이 있는지 찾아보기..(?)
  2. 홈버튼 감지 이후에 락버튼 감지를 덮어씌우기.

두 가지 방법이 있는데,,,,

1번이 있으면 좋겠지만.. 아직은 찾지 못했다!
2번 방향으로 해도 될까.....(?)(?)~~?

No detecta el Evento del Botón Bloqueo/Encendido

Realice las pruebas en 3 dispositivos físicos Samsung y Huawei(P9 Lite y Y9), solo funciono con el dispositivo de la marca Samsung, con los otros dispositivos no detecta el evento del Botón Bloqueo/Encendido.

락버튼(안드로이드) / 사일런트 버튼(iOS) 구현

안드로이드는 일단 락버튼을 감지할 수 있는걸로 아는데, 갓진님이 알아본 바로 iOS에서는 막혀있다고 한다.
안드로이드도 조사는 해 봐야 한다. 락버튼을 오래 누르면 락이 되는게아니고 전원 끄기/다시 시작 이런 메뉴가 뜨는데 이런걸 분기태울수 있는지.. 분기를 태우긴 해야하는지를 고민해봐야 한다.

iOS는 어짜피 락버튼을 할 수 없기 때문에 그 시간에 silent 버튼 감지를 구현할 수 있는지 알아보고, 가능하다면 이걸 진행!

Intercept hardware button events completely?

Hi,

Is it possible to intercept events generated by hardware buttons completely? For example if the app is active and volume up/down button is pressed, is it possible to intercept that event in the app handle it in the app specific way and most importantly prevent it from being acted upon further by the system so that the default behaviour that actually turns the volume up/down and displays the system dialog/popup showing the volume going up/down would not happen?

Thanks in advance for your reply!
K.

Execution failed for task ':hardware_buttons:compileDebugKotlin'. > Compilation error. See log for more details

After adding this to my code it does not work anymore.

`import 'package:hardware_buttons/hardware_buttons.dart';
StreamSubscription _volumeButtonSubscription; //Volume button

@OverRide
void initState() {
super.initState();
_volumeButtonSubscription =
volumeButtonEvents.listen((VolumeButtonEvent event) {
if (event == VolumeButtonEvent.VOLUME_UP) {
minViewer += 5;
maxViewer += 5;
} else if (event == VolumeButtonEvent.VOLUME_DOWN && minViewer >= 6) {
minViewer -= 5;
maxViewer -= 5;
}
});
}

@OverRide
void dispose() {
super.dispose();
_volumeButtonSubscription?.cancel();
}
`

Full Error:

`Launching lib\main.dart on M2007J20CG in debug mode...
Running Gradle task 'assembleDebug'...
e: D:\Development\flutter.pub-cache\hosted\pub.dartlang.org\hardware_buttons-1.0.0\android\src\main\kotlin\flutter\moum\hardware_buttons\EmptyActivityLifecycleCallbacks.kt: (8, 6): Class 'EmptyActivityLifecycleCallbacks' is not abstract and does not implement abstract member public abstract fun onActivityPaused(@nonnull p0: Activity): Unit defined in android.app.Application.ActivityLifecycleCallbacks
e: D:\Development\flutter.pub-cache\hosted\pub.dartlang.org\hardware_buttons-1.0.0\android\src\main\kotlin\flutter\moum\hardware_buttons\EmptyActivityLifecycleCallbacks.kt: (9, 5): 'onActivityPaused' overrides nothing
e: D:\Development\flutter.pub-cache\hosted\pub.dartlang.org\hardware_buttons-1.0.0\android\src\main\kotlin\flutter\moum\hardware_buttons\EmptyActivityLifecycleCallbacks.kt: (11, 5): 'onActivityResumed' overrides nothing
e: D:\Development\flutter.pub-cache\hosted\pub.dartlang.org\hardware_buttons-1.0.0\android\src\main\kotlin\flutter\moum\hardware_buttons\EmptyActivityLifecycleCallbacks.kt: (13, 5): 'onActivityStarted' overrides nothing
e: D:\Development\flutter.pub-cache\hosted\pub.dartlang.org\hardware_buttons-1.0.0\android\src\main\kotlin\flutter\moum\hardware_buttons\EmptyActivityLifecycleCallbacks.kt: (15, 5): 'onActivityDestroyed' overrides nothing
e: D:\Development\flutter.pub-cache\hosted\pub.dartlang.org\hardware_buttons-1.0.0\android\src\main\kotlin\flutter\moum\hardware_buttons\EmptyActivityLifecycleCallbacks.kt: (17, 5): 'onActivitySaveInstanceState' overrides nothing
e: D:\Development\flutter.pub-cache\hosted\pub.dartlang.org\hardware_buttons-1.0.0\android\src\main\kotlin\flutter\moum\hardware_buttons\EmptyActivityLifecycleCallbacks.kt: (19, 5): 'onActivityStopped' overrides nothing
e: D:\Development\flutter.pub-cache\hosted\pub.dartlang.org\hardware_buttons-1.0.0\android\src\main\kotlin\flutter\moum\hardware_buttons\EmptyActivityLifecycleCallbacks.kt: (21, 5): 'onActivityCreated' overrides nothing
e: D:\Development\flutter.pub-cache\hosted\pub.dartlang.org\hardware_buttons-1.0.0\android\src\main\kotlin\flutter\moum\hardware_buttons\HardwareButtonsWatcherManager.kt: (74, 42): Object is not abstract and does not implement abstract base class member public abstract fun onActivityStarted(@nonnull p0: Activity): Unit defined in flutter.moum.hardware_buttons.EmptyActivityLifecycleCallbacks

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':hardware_buttons:compileDebugKotlin'.

Compilation error. See log for more details

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 11s
Exception: Gradle task assembleDebug failed with exit code 1
`

안드로이드 memory leak 이슈

음.. 하다보니까 안드로이드에서 작업할 때 EventChannel.StreamHandler 인터페이스를 override 해서 onListen 함수에서 버튼 감지 이벤트 듣기 시작하고 onCancel 함수에서 듣던거 캔슬하는데, 앱이 종료되어도 onCancel 함수가 안불리는 버그가 있나봐여.
그래서 앱을 꺼도 버튼 감지 이벤트 캔슬이 안되어서 플러터 앱은 종료되었는데 자꾸 메시지 보내려고하니까 "W/FlutterJNI: Tried to send a platform message to Flutter, but FlutterJNI was detached from native C++. Could not send. Channel: flutter.moum.hardware_buttons.volume. Response ID: 0" 요론 메시지가 계속 올라가네요.

이런 버그가 있어서 battery 라는 플러그인에서도 이거 회피하려고하는 풀리퀘를 진행중인듯.

위 풀리퀘보고 좀 따라해서 회피해야할듯. 결국은 플러터팀에서 onCancel 함수가 제대로 불리도록 수정해 줘야겠지만!

iOS는 이런 버그가 없을수도 있지만 혹여나 앱을 종료했을 때 위와 같은 에러 메시지 안뜨나 확인해보심 좋을듯여~

나중을 위해 적어둠!

Installation Problem

Hi,

When i run my project, I get the following errors

   /....../flutter/.pub-cache/hosted/pub.dartlang.org/hardware_buttons-0.2.1/ios/Classes/VolumeButtenStreamHandler.swift:43:61: error: 'UIApplicationDidBecomeActive' has been renamed to 'UIApplication.didBecomeActiveNotification'
           notificationCenter.removeObserver(Notification.Name.UIApplicationDidBecomeActive)
                                                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                                               UIApplication.didBecomeActiveNotification
   UIKit.NSNotification.Name:11:23: note: 'UIApplicationDidBecomeActive' was obsoleted in Swift 4.2
       public static let UIApplicationDidBecomeActive: NSNotification.Name
                         ^
   /....../flutter/.pub-cache/hosted/pub.dartlang.org/hardware_buttons-0.2.1/ios/Classes/VolumeButtenStreamHandler.swift:49:42: error: 'AVAudioSessionCategoryAmbient' has been renamed to 'AVAudioSession.Category.ambient'
               try audioSession.setCategory(AVAudioSessionCategoryAmbient)
                                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                            AVAudioSession.Category.ambient
   AVFoundation.AVAudioSessionCategoryAmbient:3:12: note: 'AVAudioSessionCategoryAmbient' was obsoleted in Swift 3
   public let AVAudioSessionCategoryAmbient: AVAudioSession.Category

Do you have an idea ?

Thanks

[iOS] App rejected because access Private API com.apple.springboard.lockcomplete

Hai,,
I just success use this plugin, with functionality in android and iOS. But when i upload my iOS app to Appstore, this app was rejected. This message from Apple reviewer.

=========
Guideline 2.5.1 - Performance - Software Requirements

Your app uses or references the following non-public APIs:

com.apple.springboard.lockcomplete

The use of non-public APIs is not permitted on the App Store because it can lead to a poor user experience should these APIs change.

Continuing to use or conceal non-public APIs in future submissions of this app may result in the termination of your Apple Developer account, as well as removal of all associated apps from the App Store.

Next Steps

If you are using third-party libraries, please update to the most recent version of those libraries. If you do not have access to the libraries' source, you may be able to search the compiled binary using the "strings" or "otool" command line tools. The "strings" tool can output a list of the methods that the library calls and "otool -ov" will output the Objective-C class structures and their defined methods. These tools can help you narrow down where the problematic code resides. You could also use the "nm" tool to verify if any third-party libraries are calling these APIs.

Resources

If there are no alternatives for providing the functionality your app requires, you can use Feedback Assistant to submit an enhancement request.

========

How can i solve this? can i change this options for calling package?

Thanks

Not detect event volume

Hi,

On iPhone 6s plus, there is no event volume up and volume down.

hardware_buttons: ^0.2.2

void initState() { super.initState(); _volumeButtonSubscription = volumeButtonEvents.listen((VolumeButtonEvent event) { print(event); setState(() { hasClickVolumeDown = VolumeButtonEvent.VOLUME_DOWN == event; hasClickVolumeDown = VolumeButtonEvent.VOLUME_UP == event; }); }); }

Listen for multiple button presses

Hi, this isn't really an issue but I was wondering if there was a way to listen for multiple button presses?

e.g. Home + Lock button ..

When I try to do this (to take a screenshot on iOS) their is no recognition of either button being pressed.

Many thanks

[안드로이드] README 업데이트

image

요 부분이 자칫 이 플러그인을 사용하면 무조건 ACTION_MANAGER_OVERLAY_PERMISSION을 요청한다고 하는거같아서 오해를 없애기 위해 말을 좀 바꿔야할듯.
'볼륨 버튼을 listen 할때만 저 퍼미션을 요청한다'

Detect lock button other way.

I think it should be better to detect lock screen than lock button. (because of appstore reject issue)
Please review this method.

func applicationProtectedDataDidBecomeAvailable(_ application: UIApplication) {
        print("applicationProtectedDataDidBecomeAvailable")
    }

    func applicationProtectedDataWillBecomeUnavailable(_ application: UIApplication) {
        print("applicationProtectedDataWillBecomeUnavailable")
    }

[ios] lock button detection timing issue

Description of the issue

Lock button plugin can't detect immediately.
It's detecting when the app returns from background to foreground.

Users who use the plugin will expect Immediate detection. (like a home button action)

Do you plan to provide this feature in the future?

If you don't support it, I think you should write the README about this timing issue.

Thanks.

[Requirement] AndroidX migration.

Hi~ Thank you for developing this plugin!

But I can't use your plugin because it is not migrated to AndroidX.

I got this error.

> Configure project :hardware_buttons
WARNING: API 'variant.getJavaCompile()' is obsolete and has been replaced with 'variant.getJavaCompileProvider()'.
It will be removed at the end of 2019.
For more information, see https://d.android.com/r/tools/task-configuration-avoidance.
To determine what is calling variant.getJavaCompile(), use -Pandroid.debug.obsoleteApi=true on the command line to display a stack trace.
         *********************************************************
WARNING: This version of device_info will break your Android build if it or its dependencies aren't compatible with AndroidX.
         See https://goo.gl/CP92wY for more information on the problem and how to fix it.
         This warning prints for all Android build failures. The real root cause of the error may be unrelated.
         *********************************************************
  Command: /Users/yusong-i/development/PassionIndicator/android/gradlew app:properties

Finished with error: Please review your Gradle project setup in the android/ folder.

not working in Android v10.

I am trying to detect volume button but when i press volume button in a android v10 device, current screen of the app get freezed. After freezing, i can not go back, not able to tab any button on the scrren.
The app is running well in android 9 and lower versions but it is stucked in version 10. Please help me....i badly need this plugin.

[iOS] audioSession.removeObserver error

When canceling the StreamSubscription the app crashes either instantly or after a few seconds. The apple crash log points to audioSession.removeObserver as the last "Last Exception Backtrace (0)".

Screen Shot 2020-04-24 at 11 09 33 PM

@giantsol Can you look at this?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.