function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
sashamsasham 

how to determine fist time login from mobile

Could ypu pls someone explain 
How to determine for tye first time login thorough moble  salesforce app which is developeed usiing mobile sdk native app (from ios or android).  Is there any field that we can identify if user (customers)logged in for the first time even if they are changing device or deleting the app and downloading again on their device.
Salesforce DeveloperSalesforce Developer
Query on LoginHistory Object with UserID something as:

List<LoginHistory> userLoginList = [SELECT Id, Application, LoginTime FROM Loginhistory WHERE UserId='00528000000000' ORDER BY LoginTime];
if(userLoginList[0].Application == 'Salesforce1 for iOS'){
    //Your Logic
}

The Application could be different based on users device, could be Salesforce1 for iOS app or Salesforce1 for Android. You can filter these out easily.
sashamsasham
we have custermes using our app (developed using mobile sdk)..customer detail is stored in customer cutom object. how could i determine the custmer using very first time login using the app.the reason that login date is going to be used in custom api to do some logic (custom api is developed in salesfroce backend and called fromthe app)