com.hypertrack.sdk.HyperTrack Java Examples

The following examples show how to use com.hypertrack.sdk.HyperTrack. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MainActivity.java    From quickstart-android with MIT License 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Log.d(TAG, "onCreate");
    setContentView(R.layout.activity_main);

    TextView deviceId = findViewById(R.id.deviceIdTextView);
    trackingStatusLabel = findViewById(R.id.statusLabel);
    HyperTrack.enableDebugLogging();

    sdkInstance = HyperTrack
            .getInstance(this, PUBLISHABLE_KEY)
            .addTrackingListener(this);

    deviceId.setText(sdkInstance.getDeviceID());
    Log.d(TAG, "device id is " + sdkInstance.getDeviceID());

}
 
Example #2
Source File: MainActivity.java    From live-app-android with MIT License 6 votes vote down vote up
private void initializeHyperTrack(final String hyperTrackPublicKey) {

        if (!TextUtils.isEmpty(hyperTrackPublicKey)) {
            ServiceNotificationConfig notificationConfig = new ServiceNotificationConfig.Builder()
                    .setSmallIcon(R.drawable.ic_status_bar)
                    .setLargeIcon(R.drawable.ic_notification)
                    .build();
            HyperTrack hyperTrack = HyperTrack.getInstance(this, hyperTrackPublicKey)
                    .setTrackingNotificationConfig(notificationConfig)
                    .setDeviceName(AppUtils.getDeviceName(this));

            registerReceiver(trackingStateReceiver, new IntentFilter(TrackingStateObserver.ACTION_TRACKING_STATE));
            if (hyperTrack.isRunning()) {
                onTrackingStart();
            } else {
                onTrackingStop();
            }

            beginFragmentTransaction(new TrackingFragment()).commitAllowingStateLoss();
            Log.i("getDeviceId", hyperTrack.getDeviceID());
        }
    }
 
Example #3
Source File: TrackingPresenter.java    From ridesharing-android with MIT License 5 votes vote down vote up
@SuppressWarnings("ConstantConditions")
public TrackingPresenter(@NonNull Context context, @NonNull View view) {
    mContext = context.getApplicationContext() == null ? context : context.getApplicationContext();
    mView = view;

    hyperTrack = HyperTrack.getInstance(context, HyperTrackUtils.getPubKey(context));
}
 
Example #4
Source File: ShareTripPresenter.java    From live-app-android with MIT License 5 votes vote down vote up
public ShareTripPresenter(Context context, View view, String shareUrl) {
    this.context = context.getApplicationContext() == null ? context : context.getApplicationContext();
    this.view = view;
    this.state = new ShareTripState(context);
    state.setShareUrl(shareUrl);

    hyperTrack = HyperTrack.getInstance(context, state.getHyperTrackPubKey());
    hyperTrackViews = HyperTrackViews.getInstance(context, state.getHyperTrackPubKey());
    tripsManager = HTMobileClient.getTripsManager(context);
}
 
Example #5
Source File: TrackingPresenter.java    From live-app-android with MIT License 5 votes vote down vote up
public TrackingPresenter(@NonNull Context context, @NonNull final View view) {
    this.context = context.getApplicationContext() == null ? context : context.getApplicationContext();
    this.view = view;
    state = new TrackingState(context);

    hyperTrack = HyperTrack.getInstance(context, state.getHyperTrackPubKey());
    hyperTrackViews = HyperTrackViews.getInstance(context, state.getHyperTrackPubKey());

    tripsManager = HTMobileClient.getTripsManager(context);
}
 
Example #6
Source File: SearchPlacePresenter.java    From live-app-android with MIT License 5 votes vote down vote up
public SearchPlacePresenter(Context context, View view) {
    this.context = context.getApplicationContext() == null ? context : context.getApplicationContext();
    this.view = view;
    this.state = new SearchPlaceState(context);

    hyperTrack = HyperTrack.getInstance(context, state.getHyperTrackPubKey());
    placesClient = Places.createClient(context);
    tripsManager = HTMobileClient.getTripsManager(context);
}
 
Example #7
Source File: App.java    From live-app-android with MIT License 5 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();

    HyperTrack.enableDebugLogging();
    if (!Places.isInitialized()) {
        Places.initialize(getApplicationContext(), "AIzaSyBKZejrZNZpLlemrH28Nc46XzHsRSVRxKI");
    }
}