Add Firebase analytics
Этот коммит содержится в:
@@ -4,3 +4,4 @@ local.properties
|
||||
*.iml
|
||||
build/
|
||||
.DS_Store
|
||||
google-services.json
|
||||
|
||||
+21
-4
@@ -5,6 +5,8 @@ android {
|
||||
buildToolsVersion '26.0.1'
|
||||
|
||||
defaultConfig {
|
||||
applicationId "org.traccar.client"
|
||||
buildConfigField "boolean", "HIDDEN_APP", "false"
|
||||
minSdkVersion 14
|
||||
targetSdkVersion 26
|
||||
versionCode 37
|
||||
@@ -16,10 +18,8 @@ android {
|
||||
}
|
||||
|
||||
productFlavors {
|
||||
regular {
|
||||
applicationId "org.traccar.client"
|
||||
buildConfigField "boolean", "HIDDEN_APP", "false"
|
||||
}
|
||||
regular
|
||||
google
|
||||
hidden {
|
||||
applicationId "org.traccar.client.hidden"
|
||||
buildConfigField "boolean", "HIDDEN_APP", "true"
|
||||
@@ -38,4 +38,21 @@ dependencies {
|
||||
compile 'com.android.support:design:26.0.1'
|
||||
testCompile 'junit:junit:4.12'
|
||||
testCompile 'org.robolectric:robolectric:3.4.2'
|
||||
googleCompile 'com.google.firebase:firebase-core:11.2.0'
|
||||
googleCompile 'com.google.firebase:firebase-crash:11.2.0'
|
||||
}
|
||||
|
||||
if (getGradle().getStartParameter().getTaskRequests().toString().contains("Google")) {
|
||||
apply plugin: 'com.google.gms.google-services'
|
||||
|
||||
task copyJson(type: Copy) {
|
||||
from '../../traccar-shared/google-services'
|
||||
into '.'
|
||||
include 'traccar-client-android.json'
|
||||
rename('traccar-client-android.json', 'google-services.json')
|
||||
}
|
||||
|
||||
afterEvaluate {
|
||||
preBuild.dependsOn copyJson
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<uses-permission android:name="android.permission.PROCESS_OUTGOING_CALLS" />
|
||||
|
||||
<application
|
||||
android:name="org.traccar.client.GoogleMainApplication"
|
||||
tools:replace="android:name">
|
||||
|
||||
<receiver android:name="org.traccar.client.DialLaunchReceiver" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.NEW_OUTGOING_CALL" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright 2017 Anton Tananaev (anton.tananaev@gmail.com)
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.traccar.client;
|
||||
|
||||
import com.google.firebase.analytics.FirebaseAnalytics;
|
||||
|
||||
public class GoogleMainApplication extends MainApplication {
|
||||
|
||||
private FirebaseAnalytics firebaseAnalytics;
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
firebaseAnalytics = FirebaseAnalytics.getInstance(this);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
<application
|
||||
android:label="@string/hidden_app_name"
|
||||
tools:replace="label">
|
||||
tools:replace="android:label">
|
||||
|
||||
<receiver android:name="org.traccar.client.DialLaunchReceiver" >
|
||||
<intent-filter>
|
||||
|
||||
+1
-2
@@ -1,11 +1,10 @@
|
||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:2.3.3'
|
||||
classpath 'com.google.gms:google-services:3.1.0'
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user