Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to notify user when he enter into some region using Geoloqi API?

In my Android app i used Geoloqi API for geofencing https://developers.geoloqi.com/android/getting-started .I ve created triggers using some latitude,longitude.now when user enter into those regions i ve to notify him.i ve created Receiver class implementing LQBroadcastReceiver. when i executed app all events are getting called and i m not getting which event to catch.please help me. Note:One way is setting type:callback and URL has to be provided for that purpose i need to create server program which i dont want. I created trigger with current location. GeoReceiver.java

public class GeoReceiver extends LQBroadcastReceiver {

    @Override
    public void onLocationChanged(Context arg0, Location arg1) {
        Toast.makeText(arg0, "Location Changed", Toast.LENGTH_LONG).show();

    }

    @Override
    public void onLocationUploaded(Context arg0, int arg1) {
        Toast.makeText(arg0, "Location Uploaded", Toast.LENGTH_LONG).show();

    }

    @Override
    public void onPushMessageReceived(Context arg0, Bundle arg1) {
        Toast.makeText(arg0, "PushMessage Received", Toast.LENGTH_LONG).show();

    }

    @Override
    public void onTrackerProfileChanged(Context arg0, LQTrackerProfile arg1,
            LQTrackerProfile arg2) {
        Toast.makeText(arg0, "TrackerProfile Changed", Toast.LENGTH_LONG).show();

    }
}
like image 307
P Srinivas Goud Avatar asked Nov 14 '22 05:11

P Srinivas Goud


1 Answers

If you set up C2DM push notifications, you can modify your onPushMessageReceived method to handle the trigger directly instead of displaying a notification. Then you can set up a trigger in the Geoloqi API using type=message and your method will be called.

like image 195
aaronpk Avatar answered Nov 16 '22 02:11

aaronpk