Permalink
Browse files

Adds tests, Removes compilation issues, Updates readme

  • Loading branch information...
1 parent 400970b commit 778b797b695f1f0602d97871bb41229c6d19b6ba @piyushgupta27 piyushgupta27 committed May 12, 2017
View
@@ -0,0 +1,58 @@
+language: android
+
+jdk:
+ - oraclejdk8
+
+env:
+ global:
+ - ANDROID_API_LEVEL=23
+ - EMULATOR_API_LEVEL=21
+ - ANDROID_BUILD_TOOLS_VERSION=23.0.2
+ - ANDROID_ABI=armeabi-v7a
+ - ANDROID_TAG=google_apis
+ - ADB_INSTALL_TIMEOUT=20 # minutes (2 minutes by default)
+
+before_script:
+ # Create and start emulator
+ - echo no | android create avd --force -n test -t "android-"$EMULATOR_API_LEVEL --abi $ANDROID_ABI --tag $ANDROID_TAG
+ - emulator -avd test -no-skin -no-audio -no-window &
+ - android-wait-for-emulator
+ - adb shell input keyevent 82 &
+
+before_cache:
+ - rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
+ - rm -fr $HOME/.gradle/caches/*/plugin-resolution/
+cache:
+ directories:
+ - $HOME/.gradle/caches/
+ - $HOME/.gradle/wrapper/
+
+android:
+ components:
+ # Uncomment the lines below if you want to
+ # use the latest revision of Android SDK Tools
+ - tools
+ - platform-tools
+ - tools
+ - build-tools-25.0.2
+ - android-25
+ - extra-google-google_play_services
+ - extra-google-m2repository
+ - extra-android-m2repository
+ - addon-google_apis-google-19
+ - extra-google-android-support
+
+ # The SDK version used to compile your project
+ - android-16
+ - android-21
+ - android-22
+ - android-25
+
+ # Specify at least one system image,
+ # if you need to run emulator(s) during your tests
+ - sys-img-armeabi-v7a-google_apis-$EMULATOR_API_LEVEL
+ # - sys-img-x86-android-17
+ licenses:
+ - android-sdk-preview-license-52d11cd2
+ - android-sdk-license-.+
+ - google-gdk-license-.+
View
@@ -1,31 +1,40 @@
# Live location sharing with HyperTrack
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/4fad0c93fd3749d690571a7a728ce047)](https://www.codacy.com/app/piyushguptaece/hypertrack-live-android?utm_source=github.com&utm_medium=referral&utm_content=hypertrack/hypertrack-live-android&utm_campaign=badger) [![Slack Status](http://slack.hypertrack.com/badge.svg)](http://slack.hypertrack.com)
-If your users can track their Uber coming to them turn-by-turn with an accurate ETA, why not track friends, colleagues, buyers and sellers similarly! Facebook Messenger and Google Maps recently added functionality for live location sharing and Whatsapp is likely to follow soon. Now it’s your turn.
+If your users can track their Uber coming to them turn-by-turn with an accurate ETA, why not track friends, colleagues, buyers, and sellers similarly! [Facebook Messenger](https://newsroom.fb.com/news/2017/03/introducing-live-location-in-messenger/) and [Google Maps](https://blog.google/products/maps/share-your-trips-and-real-time-location-google-maps/) recently added functionality for live location sharing and Whatsapp is likely to follow soon. Now it’s your turn.
+
+This open source repo uses [HyperTrack](https://www.hypertrack.com) to enable location sharing and real-time tracking of your friends and family. Scrape parts of this app to add live location sharing into your own app, or fork the repo and modify it to your own need to build your own brand new app.
![Live Tracking Demo](https://raw.githubusercontent.com/hypertrack/hypertrack-live-android/master/live_location_sharing.gif)
-Use this open source repo to build live location sharing for your app users.
+## Example App
+If you want to experience the app or want to share live location amongst your friends & family, get it from Play Store.
-### Example App
-If you want to experience the app or want o share live location amongst your friends & family, get it from Play Store.
-
-<a href='https://play.google.com/store/apps/details?id=io.hypertrack.sendeta&pcampaignid=MKT-Other-global-all-co-prtnr-py-PartBadge-Mar2515-1'><img alt='Get it on Google Play' src='https://play.google.com/intl/en_us/badges/images/generic/en_badge_web_generic.png'/></a>
+<a href='https://play.google.com/store/apps/details?id=io.hypertrack.sendeta&pcampaignid=MKT-Other-global-all-co-prtnr-py-PartBadge-Mar2515-1'><img alt='Get it on Google Play' src='https://play.google.com/intl/en_us/badges/images/generic/en_badge_web_generic.png' width="150"/></a>
## Usage
-**To use this as your own app:**
- 1. Clone the project.
- 2. Get your HyperTrack API keys [here](https://dashboard.hypertrack.com/signup), and add the publishable key to [gradle.properties](https://github.com/hypertrack/hypertrack-live-android/blob/master/gradle.properties) file. To get to know more about API keys, refer to the [Authentication](https://docs.hypertrack.com/gettingstarted/authentication.html) section in our documentation.
- 3. Get [Google Map API Key](https://developers.google.com/maps/documentation/android-api/signup) and add them to the AndroidManifest.xml.
- 4. HyperTrack SDKs require FCM integration for enhanced realtime tracking experiences. Refer to our [FCM Integration guide](https://docs.hypertrack.com/sdks/android/guides/gcm-integration.html) for detailed info. Once you have either an existing account on [Google Developer](https://console.developers.google.com/) or a new account [Firebase console](https://console.firebase.google.com), you will need to add [google-services.json](https://support.google.com/firebase/answer/7015592) file for your app to remove the below compilation failure.
+### To use this as your own app
+
+1. Clone the project.
+
+2. Get your HyperTrack API keys [here](https://dashboard.hypertrack.com/signup), and add the publishable key to [gradle.properties](https://github.com/hypertrack/hypertrack-live-android/blob/master/gradle.properties) file. Refer to the [Authentication](https://docs.hypertrack.com/gettingstarted/authentication.html) docs to learn more about keys.
+
+3. Get [Google Map API Key](https://developers.google.com/maps/documentation/android-api/signup) and add them to the AndroidManifest.xml.
- > Error:Execution failed for task ':app:processDebugGoogleServices'.
- > File google-services.json is missing. The Google Services Plugin cannot function without it.
- > Searched Location:
- > /Users/piyush/StudioProjects/hypertrack-live-android/app/src/debug/google-services.json
- > /Users/piyush/StudioProjects/hypertrack-live-android/app/google-services.json
-
-**If you want to build live location sharing within your own app, following this [step-by-step tutorial]((https://www.hypertrack.com/tutorials/live-location-sharing-android-messaging-app)) that walks through how you can embed this code in your app.**
+4. For the app to be released on playstore, you will have to change the app's package name.
+ - Change the package name in the [AndroidManifest.xml](https://github.com/hypertrack/hypertrack-live-android/blob/master/app/src/main/AndroidManifest.xml#L4) file.
+ - Refactor the name of your package with right click -> refactor -> rename in the tree view, then Android studio will display a window, select "rename package" option.
+ - Change manually the application Id in the [build.gradle](https://github.com/hypertrack/hypertrack-live-android/blob/master/app/build.gradle#L26) file. Once done, clean and rebuild the project.
+
+5. HyperTrack SDKs require FCM integration for enhanced real-time tracking experiences. Refer to our [FCM Integration guide](https://docs.hypertrack.com/sdks/android/guides/gcm-integration.html) for detailed info.
+ - Uncomment `HyperTrackLiveFCMListenerService` service tag in the [AndroidManifest.xml](https://github.com/hypertrack/hypertrack-live-android/blob/master/app/src/main/AndroidManifest.xml#L160) file.
+ - Uncomment [HyperTrackLiveFCMListenerService](https://github.com/hypertrack/hypertrack-live-android/blob/master/app/src/main/java/io/hypertrack/sendeta/service/HyperTrackLiveFCMListenerService.java#L35) file.
+ - Once you have either an existing account on [Google Developer](https://console.developers.google.com/) or a new account [Firebase console](https://console.firebase.google.com), you will need to add [google-services.json](https://support.google.com/firebase/answer/7015592) file for your app to remove the below compilation failure.
+ - Uncomment `apply google-services plugin` in [build.gradle](https://github.com/hypertrack/hypertrack-live-android/blob/master/app/build.gradle#L75) file.
+
+### To build live location sharing within your own app
+
+Follow [this step-by-step tutorial](https://www.hypertrack.com/tutorials/live-location-sharing-android-messaging-app) that walks through how you can embed this code in your app.
## Documentation
For detailed documentation of the APIs, customizations and what all you can build using HyperTrack, please visit the official [HyperTrack Docs](https://docs.hypertrack.com/).
@@ -36,7 +45,7 @@ Feel free to clone, use, and contribute back via [pull request](https://help.git
We are excited to see what live location feature you build in your app using this project. Do ping us at help@hypertrack.io once you build one, and we would love to feature your app on our blog!
## Support
-Join our [Slack community](http://slack.hypertrack.com) for instant responses, or interact with our growing [Community](https://community.hypertrack.com). You can also email us at help@hypertrack.com.
+Join our [Slack community](http://slack.hypertrack.com) for instant responses, or interact with our growing [community](https://community.hypertrack.com). You can also email us at help@hypertrack.com.
## Dependencies
* [Google v7 appcompat library](https://developer.android.com/topic/libraries/support-library/packages.html#v7-appcompat)
View
@@ -18,9 +18,9 @@ android {
abortOnError false
}
- def gradlePropertiesFile = rootProject.file("gradle.properties");
- def gradleProperties = new Properties()
- gradleProperties.load(new FileInputStream(gradlePropertiesFile))
+ def keyPropertiesFile = rootProject.file("key.properties");
+ def keyProperties = new Properties()
+ keyProperties.load(new FileInputStream(keyPropertiesFile))
defaultConfig {
applicationId "io.hypertrack.sendeta"
@@ -29,7 +29,7 @@ android {
minSdkVersion 19
targetSdkVersion 25
resValue "string", "app_name", "HyperTrack Live"
- buildConfigField "String", "HYPERTRACK_PK", gradleProperties['hypertrack_publishable_key']
+ buildConfigField "String", "HYPERTRACK_PK", keyProperties['HYPERTRACK_PUBLISHABLE_KEY']
buildConfigField "String", "HYPERTRACK_BASE_URL", '"https://api.hypertrack.com/api/v1/"'
resValue "string", "deeplink_scheme", "com.hypertracklive"
resValue "string", "tracking_url", "www.trck.at"
@@ -39,8 +39,7 @@ android {
buildTypes {
release {
- debuggable false
- minifyEnabled true
+ minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
@@ -49,6 +48,9 @@ android {
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
+ testCompile 'org.mockito:mockito-core:2.7.22'
+ testCompile 'org.robolectric:robolectric:3.0'
+ testCompile 'org.robolectric:shadows-support-v4:3.0'
compile("com.hypertrack:android:0.2.2:release@aar") {
transitive = true;
@@ -64,4 +66,10 @@ dependencies {
compile 'com.github.tajchert:WaitingDots:0.4.0'
}
-apply plugin: 'com.google.gms.google-services'
+/**
+ * - Uncomment `HyperTrackLiveFCMListenerService` service tag in the <a href="https://github.com/hypertrack/hypertrack-live-android/blob/master/app/src/main/AndroidManifest.xml#L161">AndroidManifest.xml</a> file.
+ * - Uncomment <a href="https://github.com/hypertrack/hypertrack-live-android/blob/master/app/src/main/java/io/hypertrack/sendeta/service/HyperTrackLiveFCMListenerService.java#L36">HyperTrackLiveFCMListenerService.java</a> file.
+ * - Once you have either an existing account on <a href="https://console.developers.google.com/">Google Developer</a> or a new account <a href="https://console.firebase.google.com">Firebase console</a>, you will need to add <a href="https://support.google.com/firebase/answer/7015592">google-services.json</a> file for your app to remove the below compilation failure.
+ * - Uncomment `apply google-services plugin` in <a href="https://github.com/hypertrack/hypertrack-live-android/blob/master/app/build.gradle#L75">build.gradle</a> file.
+ */
+//apply plugin: 'com.google.gms.google-services'
@@ -137,7 +137,7 @@
-->
<meta-data
android:name="com.google.android.geo.API_KEY"
- android:value=<Add your Google Map API key> />
+ android:value="Add your Google Map API key" />
<meta-data
android:name="com.google.android.gms.version"
@@ -152,13 +152,19 @@
android:name=".service.FetchLocationIntentService"
android:exported="false" />
- <service
- android:name=".service.MetaFCMListenerService"
+ <!--
+ * - Uncomment `HyperTrackLiveFCMListenerService` service tag in the <a href="https://github.com/hypertrack/hypertrack-live-android/blob/master/app/src/main/AndroidManifest.xml#L161">AndroidManifest.xml</a> file.
+ * - Uncomment <a href="https://github.com/hypertrack/hypertrack-live-android/blob/master/app/src/main/java/io/hypertrack/sendeta/service/HyperTrackLiveFCMListenerService.java#L36">HyperTrackLiveFCMListenerService.java</a> file.
+ * - Once you have either an existing account on <a href="https://console.developers.google.com/">Google Developer</a> or a new account <a href="https://console.firebase.google.com">Firebase console</a>, you will need to add <a href="https://support.google.com/firebase/answer/7015592">google-services.json</a> file for your app to remove the below compilation failure.
+ * - Uncomment `apply google-services plugin` in <a href="https://github.com/hypertrack/hypertrack-live-android/blob/master/app/build.gradle#L75">build.gradle</a> file.
+ -->
+ <!-- <service
+ android:name=".service.HyperTrackLiveFCMListenerService"
android:exported="false">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
- </service>
+ </service> -->
</application>
@@ -30,16 +30,6 @@ of this software and associated documentation files (the "Software"), to deal
//screen identifier
public int mId;
- public int id;
- public String uuid;
-
- // Used for Push Destination Location feature
- public Double lat;
- public Double lng;
-
- // Used for RequestETA
- public String address;
-
// Used for Track feature
public String taskID;
public String shortCode;
@@ -23,12 +23,17 @@ of this software and associated documentation files (the "Software"), to deal
*/
package io.hypertrack.sendeta.service;
-import com.hypertrack.lib.HyperTrackFirebaseMessagingService;
-
/**
* Created by piyush on 27/07/16.
*/
-public class MetaFCMListenerService extends HyperTrackFirebaseMessagingService {
+
+/**
+ * - Uncomment `HyperTrackLiveFCMListenerService` service tag in the <a href="https://github.com/hypertrack/hypertrack-live-android/blob/master/app/src/main/AndroidManifest.xml#L161">AndroidManifest.xml</a> file.
+ * - Uncomment <a href="https://github.com/hypertrack/hypertrack-live-android/blob/master/app/src/main/java/io/hypertrack/sendeta/service/HyperTrackLiveFCMListenerService.java#L36">HyperTrackLiveFCMListenerService.java</a> file.
+ * - Once you have either an existing account on <a href="https://console.developers.google.com/">Google Developer</a> or a new account <a href="https://console.firebase.google.com">Firebase console</a>, you will need to add <a href="https://support.google.com/firebase/answer/7015592">google-services.json</a> file for your app to remove the below compilation failure.
+ * - Uncomment `apply google-services plugin` in <a href="https://github.com/hypertrack/hypertrack-live-android/blob/master/app/build.gradle#L75">build.gradle</a> file.
+ */
+//public class HyperTrackLiveFCMListenerService extends HyperTrackFirebaseMessagingService {
// No need to implement/override any method for HyperTrack SDK's Gcm/Fcm integration
// In case onMessageReceived method is overridden, super.onMessageReceived() method should be called.
-}
+//}
@@ -1,50 +0,0 @@
-/*
-The MIT License (MIT)
-
-Copyright (c) 2015-2017 HyperTrack (http://hypertrack.com)
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-*/
-package io.hypertrack.sendeta.util;
-
-/**
- * Created by piyush on 29/06/16.
- */
-public class AnalyticsConstants {
-
- public class Event {
- // Signup Events
- public static final String ENTERED_NAME = "Entered name";
- public static final String UPLOADED_PROFILE_PHOTO = "Uploaded profile photo";
-
- // Location Sharing Events
- public static final String STARTED_SHARING = "Started a trip";
-
- // Tapped on Icons during a Live Trip
- public static final String TAPPED_SHARE_ICON = "Tapped on share icon on live trip";
- public static final String TAPPED_NAVIGATE_ICON = "Tapped on navigate icon on live trip";
- public static final String TAPPED_STOP_SHARING = "Tapped on end trip CTA on live trip";
- }
-
- public class EventParam {
- public static final String STATUS = "status";
- public static final String ERROR_MESSAGE = "error_message";
- public static final String SHARED_CURRENT_TRIP_BEFORE = "had_shared_this_trip_before";
- }
-}
@@ -54,20 +54,20 @@ of this software and associated documentation files (the "Software"), to deal
public static AppDeepLink prepareAppDeepLink(Context context, Uri uri) {
AppDeepLink appDeepLink = new AppDeepLink(DEFAULT);
-
if (uri == null)
return appDeepLink;
try {
- return DeepLinkUtil.parseAppDeepLinkURI(context, appDeepLink, uri);
+ return DeepLinkUtil.parseAppDeepLinkURI(context, uri);
} catch (Exception e) {
e.printStackTrace();
}
return appDeepLink;
}
- private static void parsePathParams(Context context, AppDeepLink appDeepLink, Uri uri) {
+ private static AppDeepLink parsePathParams(Context context, Uri uri) {
+ AppDeepLink appDeepLink = new AppDeepLink(DEFAULT);
if (uri.getScheme() != null
&& uri.getScheme().equalsIgnoreCase(context.getString(R.string.deeplink_scheme))
&& !TextUtils.isEmpty(uri.getHost())
@@ -83,10 +83,12 @@ private static void parsePathParams(Context context, AppDeepLink appDeepLink, Ur
appDeepLink.shortCode = pathParams[1];
}
}
+
+ return appDeepLink;
}
- private static AppDeepLink parseAppDeepLinkURI(Context context, AppDeepLink appDeepLink, Uri uri) {
- DeepLinkUtil.parsePathParams(context, appDeepLink, uri);
+ private static AppDeepLink parseAppDeepLinkURI(Context context, Uri uri) {
+ AppDeepLink appDeepLink = DeepLinkUtil.parsePathParams(context, uri);
Set<String> queryParamNames = uri.getQueryParameterNames();
if (queryParamNames == null || queryParamNames.isEmpty())
Oops, something went wrong.

0 comments on commit 778b797

Please sign in to comment.