This is how it's going to get easier, to add Live Tracking in your medicine delivery Android application, just integrate Teliver SDK with the following simple steps.
The TeliverSDK is hosted on Bintray and is available on JCenter.
Add the dependency right into your build gradle file compile.
compile "com.teliver.sdk:TeliverSdk:1.0.12"
Sync the gradle project then add the necessary code to initialize TeliverSDK in your app.
Congratulations! If you successfully completed the previous step of integration. Now lets proceed to the next step of initializing.
To initialize you need a "TELIVER KEY". Which is a unique key needed for identifying your application and to get the core of Teliver to work.
To get the key,
Login/Register to Teliver , you can find 'TELIVER KEY' under android integration tab.
Initiate the Teliver SDK by adding the following code in your Application class.
Teliver.init(this,"TELIVER_KEY");
(Note: Write TLog.setVisible(true) in your Activity to enable logging during Development.)
Once all the above steps are fullfilled now we are ready to start a trip. To start a trip on the driver side use below snippet of code.
private void startTrip( ) {
Teliver.startTrip(tripBuilder.withUserPushObject(pushData).build( ));
Teliver.setListener(new TripListener( ) {
@Override
public void onTripStarted(Trip tripDetails) {
}
@Override
public void onTripEnded(String trackingID) {
}
@Override
public void onTripError(String reason) {
}
}
(Note. This app requires location permission and gps enabled so cross check that your app has these functionalities and if location permission or gps is not enabled then location values won't be transmitted.)
We can also send push notification from driver side to customer just in case to update the current status of the driver.
Private void sendEventPush( ) {
// userid - To whom your going to send a push.
PushData
pushData = new PushData("userId");
//pushMessage - The message you would like to send.
pushData.setMessage(pushMessage);
// payload - you can send a String or even a JSONObject in this method.
pushData.setPayload(payload);
Teliver.sendEventPush("trackingId", pushData, "tag");
}
(Note: You can send push notification only after the trip started.)
You have to stop the trip when the driver reaches the customer location. Add this segment of code to stop the trip.
private void stopTrip() {
Teliver.stopTrip("trackingId");
}
(Note:The trackingId is the same that you given during the start trip.)
This is same as we did with the driver side application. Step are similar to what we have done at driver side.
The Teliver library is hosted on Bintray and is available on JCenter.
Add the dependency right into your build.gradle file.
compile "com.teliver.sdk:TeliverSdk:1.0.8"
Sync the gradle project then add the necessary code to initialize TeliverSDK in your app.
This step is to get the key from Google maps And paste the key in your manifest.xml get the key from the URL here.
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="API_KEY_FOR_MAP"/>
Initiate the Teliver SDK by adding the following code in your Application class.
Teliver.init(this,""TELIVER_KEY"");
Once the customer is notified that the trip is started by driver, you can start tracking the driver by using the following piece of code.
Teliver.startTracking(new TripBuilder("trackingId").build());
you can start tracking the driver with listeners also, applied only when you build your own google map object.
private void startTrackingWithListeners( ) {
TrackingBuilder builder = new TrackingBuilder(new MarkerOption(trackingId)).withYourMap(googleMap).withListener(new
TrackingListener() {
@Override
public void onTrackingStarted(String trackingId) {
}
@Override
public void onLocationUpdate(String trackingId, TLocation location) {
}
@Override
public void onTrackingEnded(String trackingId) {
}
@Override
public void onTrackingError(String reason) {
}
});
Teliver.startTracking(builder.build());
}
(Note: The trackingId is the same trackingId that you used to start the trip on driver side, the trackingId is the spotting key to identify your driver.)
If you are using Firebase Cloud Messaging, simply follow this link to configure FCM with Teliver dashboard.
In your service class extending FirebaseMessagingService, you can identify whether the push is from Teliver or not by passing the remote message to isTeliverPush method.
if (Teliver.isTeliverPush(remoteMessage)) {
Map
NotificationData data = new GsonBuilder( )
.create( ).fromJson(pushData.get("description"),
NotificationData.class);
}
(Note:The remote message contains the trackingId,message and command).
To stop the ongoing tracking.
Teliver.stopTracking("trackingId");
(Note:The trackingId is the same that you given during the start trip.)
Drugs are the saviors people turn towards when in need and with the inception of drug deliveries the despair of many witnessed a halt. But the anticipation followed, which when considered by the market is cruel enough. But further knowledge of the entire system reveals that, it isn’t actually the anticipation, but keeping the consignment location in dark is the actual reason behind the doubts and hesitation. Well, Teliver provides a solution for that exact particular reason!
With the above Android Live Tracking SDK, businesses could integrate Real-Time tracking functionalities well within minutes. Live tracking medicine deliveries are no more a complication and with Teliver the possibilities are wide open.