Comments (7)
Thanks for verifying this @yannickoo. From my testing, this happens on a physical device and the behavior is actually intermittent. For my use case, the screen stays on even after I call KeepAwake.deactivate();
from react-native-keep-awake.
I can confirm that it does not work. Unfortunately it's hard to verify this in the simulator :/
This is the current code in KCKeepAwake.java
:
public void activate() {
final Activity activity = getCurrentActivity();
if (activity != null) {
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
}
});
}
}
When checking the documentation it gives us following example:
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
}
}
from react-native-keep-awake.
Oh, I got some feedback that the screen does not stay active at all.
from react-native-keep-awake.
On Android 7.1 my screen also doesn't deactivate. Maybe because of deactivate call? In documentation it says to de-activate by:
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON).
instead of:
activity.getWindow().clearFlags(android.view.WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
from react-native-keep-awake.
Not working on my Android 1.7.2 as well
from react-native-keep-awake.
+1 Not working on Android in RN 0.59
from react-native-keep-awake.
I've decided to deprecate this package in favor of https://docs.expo.io/versions/latest/sdk/keep-awake/. That package does everything this one does, and is better maintained.
from react-native-keep-awake.
Related Issues (20)
- Error when release APK HOT 10
- Android - Build fail HOT 9
- react-native link error : buildSettings.LIBRARY_SEARCH_PATHS.push is not a function HOT 3
- Support for KeepAwake only when device is charging HOT 3
- Not working on iPhone X HOT 2
- Undefined is not an object (evaluating '_reactNative.NativeModules.KCKeepAwake.activate) at index.js:506 HOT 9
- Undocumented bheavior on app state transition HOT 1
- Idempotent behavior is undocumented HOT 1
- KeepAwake.activate() not working when running the app in Xcode. Is it worth mentioning this in readme? HOT 1
- Build file 'C:\Users\Xiaojiju\Desktop\YJJ2.0\node_modules\react-native-keep-awake\android\build.gradle' line: 3 HOT 2
- Always active for ios HOT 2
- Crashes on iOS 13 as must run on Main Queue HOT 1
- RN 0.60+ support and Android X HOT 6
- Typings not released HOT 1
- Shame to Deprecate and replace with Expo cruft HOT 1
- Doesn't work after opening fullscreen player
- New non expo fork with hooks support! HOT 23
- Cannot read property 'activate' of undefined IOS HOT 4
- Add to the depreciation notice to npm HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-keep-awake.