Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I'm working on an application .. but Audiomanager is not working i can't see any error my application got crash on phone I'm using AudioManager in BroadCastReciver Class when sms recive and text of sms is same of the particular text i've set the volume should be change silent to Normal mode.

if(message.equals(pwd)) {

    AudioManager au;
    au = (AudioManager)getSystemService(Context.AUDIO_SERVICE);
    au.setRingerMode(AudioManager.RINGER_MODE_NORMAL);

    // Show Alert
    int duration = Toast.LENGTH_LONG;
    Toast toast = Toast.makeText(context, "Volumn Changed By Phone Finder App", duration);
    toast.show();
}
else {

    int duration = Toast.LENGTH_LONG;
    Toast toast = Toast.makeText(context,  "Doesn't match", duration);
    toast.show();
}
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
127 views
Welcome To Ask or Share your Answers For Others

1 Answer

Your code is working well without crash. Please paste log report of crash.

And its better to check context, message and pwd for NullPointer Exception.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...