Repository navigation
Chapter 2: Authentication
After you integrate GaragePro android SDK into your project, and your gradle sync is complete, first step is to authenticate this SDK using some unique identifiers and pass token.
We recommend that you complete this authentication function as soon as the user is signed in to the application, or before the user is allowed to perform the scan or clear process. Every other function in this SDK will fail, if this authentication step is not completed or failed.
Context context = <YourActivity>.this;
String uniqueIdentifier = <Phone Number> or <Email ID>;
String garageId = <Unique Garage Identifier>;
String userId = <Unique User Identifier>;
String passToken = <Pass Token as generated by CaRPM>;
GProAuthentication gProAuthentication = new GProAuthentication(context, uniqueIdentifier, garageId, userId, passToken);
All the parameters required to instantiate 'GProAuthentication' class -
- Context -> Pass the activity context in which this class is instantiated and used.
- Unique Identifier -> This unique identifier can be either phone number or email ID of the said user, who is using the android application in which this SDK is integrated.
- Garage ID (Optional) -> This ID is used to identify which garage is using this SDK, to better identify the scan and clear process data and reports. This ID is optional, you can pass 'null' if there is no Garage ID available.
- User ID (Optional) -> This ID is used to identify which mechanic/technician is using this SDK in a garage, to better identify the scan and clear process data and reports, and to identify the roles and usage statistics of the user. This ID is optional, you can pass 'null' if there is no User ID available.
- Pass Token -> This pass token is generated by CaRPM, and is passed to you separately.
NOTE - Please contact us for further information about this pass token at fix@carpm.in.
gProAuthentication.init();
The 'init()' function checks the authentication of the user and pass token, and creates a login session for the user. After the function is completed, results are passed onto the callback functions.
public class YourActivity extends AppCompatActivity implements GProAuthenticationListener {
....
...
@Override
public void onAuthenticationSuccess(String message) {
Log.d(TAG, "Authentication success: " + message);
// You can start your scan and clear codes process, as and when required.
}
@Override
public void onAuthenticationFailure(String message) {
Log.e(TAG, "Authentication failure: " + message);
// Write your logic to re-instantiate and recall the init() function of GProAuthentication class,
// because all your functions will fail if the authentication is not successfully completed.
}
}
NOTE - If for any reason, the SDK authentication has failed multiple times, please contact us at fix@carpm.in with the parameters (except the pass token) used to instantiate the GProAuthenticationListener class.
If you have any specific requirements or customizations, or require permission to access our GaragePro Android SDK, or any other information regarding the integration and implementation, please feel free to reach out to us at fix@carpm.in
SDK Implementation
- Chapter 1: Integration
- Chapter 2: Authentication
- Chapter 3: Scan and Clear Process
- Chapter 4: PDF Reports and Data
- Chapter 5: Live Data Scan Process
Version updates
- Chapter 6: Module-wise Scan and Clear (0.1.7)
- Chapter 7: Wired UART Transport and Force Stop (0.3.5)
- Chapter 8: C2C Serial Device Support (0.3.7)
- Chapter 9: C2C and K-Line Module Support (0.4.0)
- Chapter 10: K-Line on C2C and Deferred Scan IDs (0.4.1)
- Chapter 11: HCV DPF Regeneration (0.8.0)
- Chapter 12: NLC400 BLE Scanner Support