android {
//...
buildTypes {
Beginning in Android 6.0 (API level 23), users grant permissions to apps while the app is running, not when they install the app. This approach streamlines the app install process, since the user does not need to grant permissions when they install or update the app. It also gives the user more control over the app's functionality; for example, a user could choose to give a camera app access to the camera but not to the device location. The user can revoke the permissions at any time, by going to the app's Settings screen.
/* | |
* Copyright (C) 2008 The Android Open Source Project | |
* | |
* 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 |
Centralize the support libraries dependencies in gradle
Working with multi-modules project, it is very useful to centralize the dependencies, especially the support libraries.
A very good way is to separate gradle build files, defining something like:
root
--gradleScript
----dependencies.gradle
import android.app.Activity; | |
import android.app.Service; | |
import android.content.BroadcastReceiver; | |
import android.content.Context; | |
import android.content.Intent; | |
import android.content.IntentFilter; | |
import android.os.Bundle; | |
import android.os.IBinder; | |
import android.support.v4.content.LocalBroadcastManager; |
public static void CopyDBIfNotExists(Context context, String dbName) { | |
File db = new File(context.getDatabasePath(dbName).getPath()); | |
if (!db.exists()) { | |
File dbDirectory = new File("/data/data/" + context.getPackageName() + "/databases/"); | |
dbDirectory.mkdirs(); | |
try { | |
CopyDB(context.getAssets().open(dbName), new FileOutputStream(context.getDatabasePath(dbName).getPath())); | |
} catch (Exception e) { | |
e.printStackTrace(); | |
} |
package com.cuneytayyildiz.aktuelurunler.utils; | |
import android.content.ContentValues; | |
import android.content.Context; | |
import android.database.Cursor; | |
import android.database.SQLException; | |
import android.database.sqlite.SQLiteDatabase; | |
import android.database.sqlite.SQLiteException; | |
import android.database.sqlite.SQLiteOpenHelper; | |
import android.text.TextUtils; |
Centralize the firebase libraries dependencies in gradle
ext {
firebaseVersion = '9.0.0';
firebaseDependencies = [
core : "com.google.firebase:firebase-core:${firebaseVersion}",
database : "com.google.firebase:firebase-database:${firebaseVersion}",
storage : "com.google.firebase:firebase-storage:${firebaseVersion}",
—– BEGIN LICENSE —– | |
Michael Barnes | |
Single User License | |
EA7E-821385 | |
8A353C41 872A0D5C DF9B2950 AFF6F667 | |
C458EA6D 8EA3C286 98D1D650 131A97AB | |
AA919AEC EF20E143 B361B1E7 4C8B7F04 | |
B085E65E 2F5F5360 8489D422 FB8FC1AA | |
93F6323C FD7F7544 3F39C318 D95E6480 | |
FCCC7561 8A4A1741 68FA4223 ADCEDE07 |
{"0.3731753471884953":"-----BEGIN PGP PUBLIC KEY BLOCK-----\r\nCharset: UTF-8\r\n\r\nxv8AAABSBAAAAAATCCqGSM49AwEHAgMEIUqFbmrAOe09vcGzVXq5ScqREYgdX6yV\r\nYpYATq/sst5lOLwT4DQK4U+r/wpau0uQx1YZgj3Y/bOt+R8G2Cw7Uc3/AAAACDxn\r\naXRodWI+wv8AAACOBBATCABA/wAAAAWCWKjOEP8AAAACiwn/AAAACZCXidFimoTY\r\nLP8AAAAFlQgJCgv/AAAABJYDAQL/AAAAApsD/wAAAAKeAQAA3K4A/0tsj/6C8QZf\r\n5ahfGaTNvnDaqPIcYiVX7e+iPSHgxyGYAQDcHRGkMmavdz/pWswdtJhVxALesGVJ\r\nvhR5TE/Fw0mRf87/AAAAVgQAAAAAEggqhkjOPQMBBwIDBL7AJJJe6sRLJNfkr6gt\r\n9WviMw/UZYTvZGPJj91jVdrgSX5idaoEH0hlin6gl5ql8ScWjcLT77aaBk0Lo0jO\r\n7DsDAQgHwv8AAABtBBgTCAAf/wAAAAWCWKjOEP8AAAAJkJeJ0WKahNgs/wAAAAKb\r\nDAAAbIgBAITu9WEzFHWA4YZHUiFz3TBtDrQIduOxhr6vXbNAmkGCAP0c7W7CP4vj\r\nezaQPkzcU+oD5LMJCJgOSlCCdd58V3Bl5g==\r\n=Nsze\r\n-----END PGP PUBLIC KEY BLOCK-----\r\n"} |