을 보여주는 건배가있을 때 (백그라운드에서 실행됩니다) 간단한 서비스를 만들고 싶어
전화
public class MyPhoneReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
Bundle extras = intent.getExtras();
if (extras != null) {
// this code is for to accept the telephone call
String state = extras.getString(TelephonyManager.EXTRA_STATE);
if (state.equals(TelephonyManager.EXTRA_STATE_RINGING)) {
String phoneNumber = extras.getString(TelephonyManager.EXTRA_INCOMING_NUMBER);
Toast.makeText(context, phoneNumber, Toast.LENGTH_SHORT).show();
}
}
}
}
및 manifest.xml
<action android:name="android.intent.action.PHONE_STATE"></action>
이 코드가있을 때 토스트를 제공이 코드는 지금이 코드는 이제 myreciever
클래스에 모든 전화 상태를 보낼 이야기 클립 보드 관리자로부터 텍스트를 가져오고 싶습니다. 어떤 사람이 텍스트를 복사 할 때 myreciever
클래스를 호출 할 수있는 어떤 intent.action
상태입니까?
어떤 종류의 도움이나 코드라도 감사하겠습니다.
은 어떻게 짓 내가 –