Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9087427
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T21:41:37+00:00 2026-06-16T21:41:37+00:00

I have a Phonegap Android app that scans RFID chips. Apparently scanning RFID does

  • 0

I have a Phonegap Android app that scans RFID chips. Apparently scanning RFID does not count as a user action, because the device will go to sleep after the interval set in Android Settings (which is a maximum of 10 minutes).

So despite constant scanning, my device will go to sleep. So I need a way to tell the OS that I’m active, programtically after each RFID scan.

Currently, I am doing something that I don’t want, which is using

getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);

to prevent sleep while the app is running, but I’d like to still be able to use the sleep interval if the device is actually inactive.

I had high hopes for using powerManager.userActivity(l, false) but apparently this is only available for System apps, so I cannot set permission for it.

Any ideas how to keep the device active while not doing any touch screen interaction?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T21:41:41+00:00Added an answer on June 16, 2026 at 9:41 pm

    A WakeLock is the answer, but the key is to use ON_AFTER_RELEASE. With this flag, the user activity timer will be reset when the WakeLock is released.

    So for the NFC plugin, under the onPause method I added:

    MyMainActivity ma = (MyMainActivity) cordova.getActivity();
    wl = ((PowerManager) ma.getSystemService(Context.POWER_SERVICE))
        .newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK | PowerManager.ON_AFTER_RELEASE, "wakeywakey");
    wl.acquire();
    

    And under the onResume method I added:

    wl.release();
    

    With this arrangement, when an RFID chip is scanned, the NFC plugin will create the WakeLock and then release it, which will reset the activity timer. Also, I used SCREEN_BRIGHT_WAKE_LOCK even though it is deprecated, as this will brighten the screen if it has gone dim.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a PhoneGap app that I'm testing on webOS, Android, and iPhone. I'm
I have an app that runs fine using android phonegap 1.2 and jqm 1.0,
I have a running JQueryMobile App that Im developing with PhoneGap for Android/IPhone, and
I have a simple Android App using simple js, jquery mobile and phonegap that
I have a phonegap app on android that runs in a remote server. On
I have a phonegap app that uses jqm that works fine in android and
I have a jquery mobile app that i am wrapping in Phonegap for Iphone/Android
I have a strange problem in my PhoneGap-based android app. On certain screens, the
I have PhoneGap app running in Android. When the app starts, it inserts approximately
I am building an Android app using phoneGap and I have successfully added the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.