1

i have a problem. I want to make a location based reminder/alert in android device. I have try to code it. But it doesn't work. I try to match the data in the sqlite and address based on geocoder user location.

Here the db adapter query

public void postCheck(String addr) {
    openConn();
    Cursor cur = db.rawQuery("select " + ALAMAT + " from " + TableName, null);
    if(addr == ALAMAT && cur != null) {
        cur.moveToFirst();
        Toast.makeText(konteks, "Anda ada tugas",
                    Toast.LENGTH_LONG).show();
    } else {
        Toast.makeText(konteks, "Anda tidak ada tugas",  
                    Toast.LENGTH_LONG).show();
    }
    closeConn();
}

and this is the code in acivity

public void cekTugas() {
    //cek tugas
    if(alamat != "") {
        dbHandler.postCheck(alamat);
    }
}

I put it after thread in onCreate

//thread untuk menjalankan LBS
    timer = new Timer();
    timer.schedule(new TimerTask() {
        Handler handlerLokasi = new Handler(Looper.getMainLooper());

        @Override
        public void run() { 
            // TODO Auto-generated method stub
            handlerLokasi.post(new Runnable() {

                @Override
                public void run() {
                    // TODO Auto-generated method stub
                    cekLokasi();
                }
            });
        }
    }, 0, 300000);

    //cek tugas
    cekTugas();

Thanks for any help...

Ivan Ahmed
  • 39
  • 7
  • i make a location based reminder but it doesn't work. The reminder dosn't work. But i don't have any idea where is the fault. The database does exists and i think the query is right but why the reminder doesn't work – Ivan Ahmed Mar 30 '13 at 01:07
  • insted of this first get currnt location. useing that location metch lat, long or addres in your database. if it exits then show alert. try this way.. – Dhaval Parmar Mar 30 '13 at 08:28
  • I don't see any code where you try to read the location, or to match it. – CL. Mar 30 '13 at 10:53
  • @DhawalSodhaParmar Can you write a sample query to get alert when current location co-ordinates and existing co-ordinates in SQLite DB matches? Thanks in advance.. – Shailendra Madda May 07 '14 at 13:27

0 Answers0