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

  • SEARCH
  • Home
  • 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 8265619
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T04:52:08+00:00 2026-06-08T04:52:08+00:00

I am encountering this error whenever i do a mp.stop in android, basically an

  • 0

I am encountering this error whenever i do a mp.stop in android, basically an sms with body RING:(password) to play the audio and STOP:(password) to stop the audio. The play is working fine but not the stop.

  MediaPlayer mp = MediaPlayer.create(context, R.raw.braincandy);

    if (correctSHA1 != null) {    


        if (intent.getAction().equals(SMS_RECEIVED)) {

          Bundle bundle = intent.getExtras();   
          if (bundle != null) {

          Object pdus[] = (Object[]) bundle.get("pdus");
          SmsMessage smsMessage[] = new SmsMessage[pdus.length];   

          for(int i = 0; i < pdus.length; i++) {   
              smsMessage[i] = SmsMessage.createFromPdu((byte[])pdus[i]);
            if (smsMessage[i].getMessageBody().contains("RING:")) {    
                String[] tokens = smsMessage[i].getMessageBody().split(":"); 
                Log.v(TAG, "RING SMS Message keyword detected");

                if (tokens.length >= 2) {    

                    Log.v(TAG, "Token 1: " + tokens[0]);
                    Log.v(TAG, "Token 2: " + tokens[1]);

                    String SHA1hash = PhoneFinder.getSHA1(tokens[1]);   

                    Log.v(TAG, "SHA1 Hash:" + SHA1hash);
                    Log.v(TAG, "Correct SHA1:" + correctSHA1);

                    if (SHA1hash.equals(correctSHA1)) {    
                        Log.v(TAG, "SHA1 hash matched!");
                        this.abortBroadcast(); //Abort Broadcast for SMS Message

                        String to = smsMessage[i].getOriginatingAddress (); 
                        SmsManager sm = SmsManager.getDefault(); 

                        sm.sendTextMessage (to, null, "success!", null, null);
                        NotificationManager nm = (NotificationManager) context.getSystemService (Context.NOTIFICATION_SERVICE); 
                        Notification notification = new Notification(android.R.drawable.ic_dialog_info, "Alert", System.currentTimeMillis());
                        PendingIntent contentIntent = PendingIntent.getActivity (context, 0, new Intent (context, PhoneFinder.class), 0);
                        notification.setLatestEventInfo (context, "GPS address", "You have been detected", contentIntent);
                        nm.notify (R.string.service_start, notification);

                        //context.startService(new Intent(context, MyService.class));
                        mp.start();

                        }    

                    }    
                } 
                else if (smsMessage[i].getMessageBody().contains("STOP:")) {
                    String[] tokens = smsMessage[i].getMessageBody().split(":"); 
                    Log.v(TAG, "STOP SMS Message keyword detected");

                    if (tokens.length >= 2) {    

                        Log.v(TAG, "STOP Token 1: " + tokens[0]);
                        Log.v(TAG, "STOP Token 2: " + tokens[1]);

                        String SHA1hash = PhoneFinder.getSHA1(tokens[1]);   

                        Log.v(TAG, "STOP SHA1 Hash:" + SHA1hash);
                        Log.v(TAG, "STOP Correct SHA1:" + correctSHA1);

                        if (SHA1hash.equals(correctSHA1)) {    
                            Log.v(TAG, "STOP SHA1 hash matched!");
                            this.abortBroadcast(); //Abort Broadcast for SMS Message


                        //  context.stopService(new Intent(context, MyService.class));
                            if (mp.isPlaying())
                                mp.pause();
                            }    
                }

Logcat error:

07-22 10:11:30.082: V/Logging Activity(7207): New Broadcast Receiver
07-22 10:11:30.082: V/Logging Activity(7207): Password: passwd
07-22 10:11:30.087: V/MediaPlayer-JNI(7207): native_setup
07-22 10:11:30.087: V/MediaPlayer(7207): constructor
07-22 10:11:30.092: V/MediaPlayer(7207): setListener
07-22 10:11:30.092: V/MediaPlayer-JNI(7207): setDataSourceFD: fd 57
07-22 10:11:30.092: V/MediaPlayer(7207): setDataSource(57, 652, 2625504)
07-22 10:11:30.107: V/MediaPlayer(7207): setVideoSurfaceTexture
07-22 10:11:30.107: V/MediaPlayer(7207): prepare
07-22 10:11:30.112: V/MediaPlayer(7207): message received msg=5, ext1=0, ext2=0
07-22 10:11:30.112: V/MediaPlayer(7207): New video size 0 x 0
07-22 10:11:30.112: V/MediaPlayer(7207): callback application
07-22 10:11:30.117: V/MediaPlayer(7207): back from callback
07-22 10:11:30.117: V/MediaPlayer(7207): message received msg=1, ext1=0, ext2=0
07-22 10:11:30.117: V/MediaPlayer(7207): prepared
07-22 10:11:30.117: V/MediaPlayer(7207): signal application thread
07-22 10:11:30.117: V/MediaPlayer(7207): callback application
07-22 10:11:30.117: V/MediaPlayer(7207): back from callback
07-22 10:11:30.117: V/MediaPlayer(7207): prepare complete - status=0
07-22 10:11:30.122: D/Gsm/SmsMessage(7207): SMS SC timestamp: 1342923088000
07-22 10:11:30.132: V/Logging Activity(7207): RING SMS Message keyword detected
07-22 10:11:30.132: V/Logging Activity(7207): Token 1: RING
07-22 10:11:30.132: V/Logging Activity(7207): Token 2: abc123
07-22 10:11:30.137: V/Logging Activity(7207): SHA1 Hash:6367c48dd193d56ea7b0baad25b19455e529f5ee
07-22 10:11:30.137: V/Logging Activity(7207): Correct SHA1:6367c48dd193d56ea7b0baad25b19455e529f5ee
07-22 10:11:30.137: V/Logging Activity(7207): SHA1 hash matched!
07-22 10:11:30.167: V/MediaPlayer-JNI(7207): start
07-22 10:11:30.167: V/MediaPlayer(7207): start
07-22 10:11:30.202: E/MediaPlayer(7207): mOnVideoSizeChangedListener is null. Failed to send MEDIA_SET_VIDEO_SIZE message.
07-22 10:11:30.202: I/MediaPlayer(7207): Don't send intent. msg.arg1 = 0, msg.arg2 = 0
07-22 10:11:30.202: E/MediaPlayer(7207): mOnPreparedListener is null. Failed to send MEDIA_PREPARED message.
07-22 10:11:37.592: V/Logging Activity(7207): New Broadcast Receiver
07-22 10:11:37.592: V/Logging Activity(7207): Password: passwd
07-22 10:11:37.592: V/MediaPlayer-JNI(7207): native_setup
07-22 10:11:37.592: V/MediaPlayer(7207): constructor
07-22 10:11:37.592: V/MediaPlayer(7207): setListener
07-22 10:11:37.592: V/MediaPlayer-JNI(7207): setDataSourceFD: fd 57
07-22 10:11:37.592: V/MediaPlayer(7207): setDataSource(57, 652, 2625504)
07-22 10:11:37.612: V/MediaPlayer(7207): setVideoSurfaceTexture
07-22 10:11:37.612: V/MediaPlayer(7207): prepare
07-22 10:11:37.617: V/MediaPlayer(7207): message received msg=5, ext1=0, ext2=0
07-22 10:11:37.617: V/MediaPlayer(7207): New video size 0 x 0
07-22 10:11:37.617: V/MediaPlayer(7207): callback application
07-22 10:11:37.617: V/MediaPlayer(7207): back from callback
07-22 10:11:37.617: V/MediaPlayer(7207): message received msg=1, ext1=0, ext2=0
07-22 10:11:37.617: V/MediaPlayer(7207): prepared
07-22 10:11:37.617: V/MediaPlayer(7207): signal application thread
07-22 10:11:37.617: V/MediaPlayer(7207): callback application
07-22 10:11:37.617: V/MediaPlayer(7207): back from callback
07-22 10:11:37.617: V/MediaPlayer(7207): prepare complete - status=0
07-22 10:11:37.617: D/Gsm/SmsMessage(7207): SMS SC timestamp: 1342923096000
07-22 10:11:37.617: V/Logging Activity(7207): STOP SMS Message keyword detected
07-22 10:11:37.617: V/Logging Activity(7207): STOP Token 1: STOP
07-22 10:11:37.617: V/Logging Activity(7207): STOP Token 2: abc123
07-22 10:11:37.617: V/Logging Activity(7207): STOP SHA1 Hash:6367c48dd193d56ea7b0baad25b19455e529f5ee
07-22 10:11:37.617: V/Logging Activity(7207): STOP Correct SHA1:6367c48dd193d56ea7b0baad25b19455e529f5ee
07-22 10:11:37.617: V/Logging Activity(7207): STOP SHA1 hash matched!
07-22 10:11:37.617: V/MediaPlayer(7207): isPlaying: 0
07-22 10:11:37.617: V/MediaPlayer-JNI(7207): isPlaying: 0
07-22 10:11:37.617: E/MediaPlayer(7207): mOnVideoSizeChangedListener is null. Failed to send MEDIA_SET_VIDEO_SIZE message.
07-22 10:11:37.617: I/MediaPlayer(7207): Don't send intent. msg.arg1 = 0, msg.arg2 = 0
07-22 10:11:37.617: E/MediaPlayer(7207): mOnPreparedListener is null. Failed to send MEDIA_PREPARED message.
  • 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-08T04:52:09+00:00Added an answer on June 8, 2026 at 4:52 am
    MediaPlayer mp = MediaPlayer.create(context, R.raw.braincandy);
    mp.pause();
    

    You are not allowed to call pause() right after initializing a media player. You can call it only at certain states. These states are defined by a state diagram illustrated in below figure.

    EDIT: You said you want it to stop, so things have changed.

    • Move the initialization inside the RING clause and call start().
    • Call stop() directly inside STOP clause and call reset() right after.
    • Ensure that a RING is always followed by a STOP and a STOP is followed by a RING message. Otherwise, you will call the MediaPlayer functions in wrong states and get the same errors.

    enter image description here

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

Sidebar

Related Questions

I am encountering this error whenever the button is clicked to collapse/expand the panel.
I have been encountering this error for my project, which involves working with Digital
While trying to update my Android SDK I am encountering this error when trying
I am encountering this error when I am loading an Ad Hoc build of
I seem to be encountering an error when reading from a text file. This
I'm encountering this error : Membership credential verification failed. when I try to login
I'm encountering this error while compiling some old VC++ 6.0 source code. error C2632:
I'm building a simple paint app and encountering this error given by the logcat:
I have tried invoking Ant programmatically, but I am encountering this error Exception in
I suddenly started encountering this error out of no where and need some help.

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.