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 8017113
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T20:44:47+00:00 2026-06-04T20:44:47+00:00

My app needs to play a ringtone if an sms is coming in (broadcastreceiver).

  • 0

My app needs to play a ringtone if an sms is coming in (broadcastreceiver). It’s functioning correctly if my phone is on. But in sleep the SMS is coming in and nothing is happening. If I get the phone from standby…my ringtone is playing….

PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
 PowerManager.WakeLock wl = pm.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK, "My Tag");
 wl.acquire();
   .. play the ringtone and do other actions..
 wl.release();

in the manifest I putted also:

<uses-permission android:name="android.permission.WAKE_LOCK" />

Does anybody know what I’m missing?!

  • 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-04T20:44:49+00:00Added an answer on June 4, 2026 at 8:44 pm

    The phone is reacting at a Textmssage with a broadcast receiver. In de broadcast receiver I just start an activity

    In that activity (new class) I put the OnCreate:

    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.niceapp);
    
        //if phone is in on sleep ...wake him up
        AlarmAlertWakeLock.acquireCpuWakeLock(this);
    

    In the OnStop I put:

        AlarmAlertWakeLock.releaseCpuLock();
    

    That worked for me.

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

Sidebar

Related Questions

I'm building a Windows Phone 7.5 app that needs to play videos that are
I am developing an app that needs to play music while on the phone.
I'm trying to get smooth audio playback for an app that needs to play
I've got a web app that needs to play a handful of sounds. The
I am designing an android app that needs to play a sound every minute
I have a .net client app that needs to play some content (images, movies,
I'm working on an App that needs to have a custom ringtone for certain
My app needs to play some audio files and I want to fade-out the
I am working with an app that needs to play a sound tap at
I have an app in the store that needs to play Music in background

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.