Issue in Updating User's Location manually


#1

Hi,

I have implemented CleverTap SDK v.3.1.2 to our app. I am facing issue when trying to update user’s location manually.

As per doc I have used ‘setLocation’ api (https://support.clevertap.com/docs/working-with-user-profiles.html#user-location-handling). Below is the code snippet for the same

CleverTapAPI clevertap = CleverTapAPI.getInstance(mContext);
Location location = clevertap.getLocation();
CleverTapAPI.getInstance(mContext).setLocation(location);

On Manifest below permission granted
**uses-permission android:name=“android.permission.ACCESS_COARSE_LOCATION” **

I could see latitude and longitude values are passing to cleverTap via Charles when I launch app. but I couldn’t see the updated value on dashboard.

On Dashboard I could see as below.
Chennai, Tamil Nadu, India
Lat - Unknown
Long - Unknown

I would like to know why Lat/Long value is showing as UnKnown though its sending to CleverTap. Please help to identify if the issue is in implementation.


#2

Refactor your code to :

CleverTapAPI clevertap = CleverTapAPI.getInstance(mContext);
Location location = clevertap.getLocation();
clevertap.setLocation(location); //no need for a new instance of clevertap here
Log.d("CIDLoc", String.valueOf(""+location.getLatitude()));
//check whether you are really getting latitude or not

Here are some steps to manually update user location:
https://support.clevertap.com/docs/android/advanced-topics.html#manually-updating-user-location
If you are using a device with os >=6.0, make sure you have location permissions.Go to settings -> Apps -> Your App -> Permissions -> Location.

Try to fire a user event so that it will update user lat,long.


#3

I also have permission android.permission.ACCESS_COARSE_LOCATION

But all I see is Lat, Long in the profile.
City, State, Country is not shown. It shows Unknown, Unknown.

How can I get City, State, Country. Do I have to manually pass it in User Profile?


#4

Hey @Sirisha_Ch,

Could you please check whether you have enabled Device Network Information Reporting in your integration.

Link : https://developer.clevertap.com/docs/sdk-changes-for-gdpr-compliance#section-device-network-information-reporting

This enable CleverTap to capture the ip address and populate the Geography location of the user.