android - ContentObservers onChange is not getting called -
i trying check if there change in gps settings. onchange not being called.
contentresolver.registercontentobserver(setting, true, new contentobserver(handler) { @override public boolean deliverselfnotifications(){ return true; } @override public void onchange(boolean selfchange) { super.onchange(selfchange); log.d("onchange","in."); } @override public void onchange(boolean selfchange, uri uri) { super.onchange(selfchange, uri); log.d("onchange","in."); } });
the handler called
looper looper = looper.getmainlooper(); handler handler = new handler(looper);
the uri used is
uri setting = settings.secure.geturifor(settings.secure.location_mode);
so,here did [pskink]{https://stackoverflow.com/users/2252830/pskink} pointed out instead ob using content observer used broadcastreceiver listen locationmanager.mode_changed_action
Comments
Post a Comment