@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_system_cfg); sp = this.getSharedPreferences("userInfo", Context.MODE_WORLD_READABLE); sp = getPreferences(MODE_PRIVATE); }
@Override protected void onDestroy() { // TODO Auto-generated method stub mContext.unregisterReceiver(broad); audioManager.setMode(AudioManager.MODE_NORMAL); if (player != null && player.isPlaying()) { player.stop(); player.release(); player = null; } super.onDestroy(); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_have_call); code = getIntent().getStringExtra("code"); type = getIntent().getIntExtra("type", -1); IntentFilter intentFilter = new IntentFilter(); intentFilter.addAction(broad_interaput_Action); broad = new MyBroadcastReciver(); this.registerReceiver(broad, intentFilter); palyMusic(R.raw.callbeep); // try // { // player = MediaPlayer.create(mContext, R.raw.callbeep); // audioManager = (AudioManager) // this.getSystemService(mContext.AUDIO_SERVICE); // audioManager.setSpeakerphoneOn(true); // // audioManager.setMode(AudioManager.MODE_IN_COMMUNICATION);// // 把模式调成听筒放音模式 // player.stop(); // player.prepare(); // player.start(); // player.setOnCompletionListener(new OnCompletionListener() // { // // @Override // public void onCompletion(MediaPlayer mp) // { // // TODO Auto-generated method stub // player.release(); // player = null; // HaveCallActivity.this.finish(); // } // }); // } catch (Exception e) // { // e.printStackTrace(); // } AcquireWakeLock(1000); }