i create an alarm service and call it in main activity, but get this error that: "unable to start service
".............
i create table in db.java and set variable by InsertMagnt in alarmservice.
DB DataBase = new DB();
DataBase.InsertMagnt(Acce_x, Acce_y, Acce_z, "", "", 1);
DataBase.InsertMagnt(Meg_x, Meg_y, Meg_z, datetime, "", 2);
DataBase.InsertMagnt(Tilt_x, Tilt_y, Tilt_z, datetime, Direct, 3);
DataBase.InsertMagnt(lon, lat, 0, datetime, "", 4);
and main activity is:
Intent AlarmIntent = new Intent(MainActivity.this, AlarmService.class);
pending = PendingIntent.getService(MainActivity.this, 0, AlarmIntent, 0);
alarm = (AlarmManager) getSystemService(ALARM_SERVICE);
btnStart.setOnClickListener(new OnClickListener() {
public void onClick(View view) {
Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(System.currentTimeMillis());
calendar.add(Calendar.SECOND, 5);
alarm.setRepeating(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), 10 * 1000, pending);
Toast.makeText(MainActivity.this, "Service Start", Toast.LENGTH_SHORT).show();
}
});
i get this errors:
08-08 13:24:21.334: E/AndroidRuntime(9000): java.lang.RuntimeException: Unable to start service com.example.farzaneh.AlarmService@417c9cd8 with Intent { flg=0x4 cmp=com.example.farzaneh/.AlarmService (has extras) }: android.database.sqlite.SQLiteException: unrecognized token: "')" (code 1): , while compiling: INSERT INTO Acce_Log (X,Y,Z,Date) VALUES (0.0,0.0,0.0')