이 코드는 MainActicity.java에 있는 코드이고. 알람을 설정하는 코드입니다.
private void setAlarm() {
mManager.set(AlarmManager.RTC_WAKEUP, mCalendar.getTimeInMillis(), pendingIntent());
Log.i("HelloAlarmActivity", mCalendar.getTime().toString());
}
이 코드는 알람시 Intent를 실행하게 하는 코드입니다. 또한 이코드도 MainActicity.java에 속해있습니다.
private PendingIntent pendingIntent() {
Intent i = new Intent(getApplicationContext(), OnBlue.class);
PendingIntent pi = PendingIntent.getActivity(this, 0, i, 0);
return pi;
}
이 코드는OnBlue.java에 속해 있는 코드입니다.
import android.bluetooth.BluetoothAdapter;
import android.util.Log;
public class OnBlue {
public void main(String args[])
{
BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
if (!mBluetoothAdapter.isEnabled())
{
mBluetoothAdapter.enable();
Log.i("BT_Activated", "Bluetooth Activated");
}
}
}
여기서 제 질문은, 어떻게 하면 저 OnBlue.java 에 있는 코드BluetoothAdapter.enable(); 를 실행할수 있을까요?
실행해봐도 안되어서 질문올립니다.
미리 감사드립니다.