本文整理汇总了Java中android.support.v4.BuildConfig类的典型用法代码示例。如果您正苦于以下问题:Java BuildConfig类的具体用法?Java BuildConfig怎么用?Java BuildConfig使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
BuildConfig类属于android.support.v4包,在下文中一共展示了BuildConfig类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: install
import android.support.v4.BuildConfig; //导入依赖的package包/类
public static void install(String path, File apkFile) {
Intent installIntent = new Intent(Intent.ACTION_VIEW);
//判断是否是AndroidN以及更高的版本
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
installIntent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
Uri contentUri = FileProvider.getUriForFile(UIUtils.getContext(), com.example.ggxiaozhi.store.the_basket.BuildConfig.APPLICATION_ID + ".fileProvider", apkFile);
installIntent.setDataAndType(contentUri, "application/vnd.android.package-archive");
} else {
installIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
installIntent.setDataAndType(Uri.parse("file://" + path),
"application/vnd.android.package-archive");
}
UIUtils.getContext().startActivity(installIntent);
}
示例2: sendBroadcast
import android.support.v4.BuildConfig; //导入依赖的package包/类
private void sendBroadcast(@NonNull Context context,
@Nullable String messageFrom,
@Nullable String smsMessage) {
Intent broadcastIntent = new Intent(INTENT_ACTION_SMS);
String smsCode = null;
if (smsMessage != null) {
try {
smsCode = getSmsCode(smsMessage);
} catch (StringIndexOutOfBoundsException e) {
if (BuildConfig.DEBUG) {
Log.d(SmsReceiver.class.getName(), e.getMessage());
}
}
}
broadcastIntent.putExtra(KEY_SMS_SENDER, messageFrom);
broadcastIntent.putExtra(KEY_SMS_MESSAGE, smsCode);
LocalBroadcastManager.getInstance(context).sendBroadcast(broadcastIntent);
}
示例3: send
import android.support.v4.BuildConfig; //导入依赖的package包/类
/**
* Send the current log via email or other options selected from a pop menu shown to the user. A
* new log is started when calling this function.
*/
public void send() {
if (mFile == null) {
return;
}
Intent emailIntent = new Intent(Intent.ACTION_SEND);
emailIntent.setType("*/*");
emailIntent.putExtra(Intent.EXTRA_SUBJECT, "SensorLog");
emailIntent.putExtra(Intent.EXTRA_TEXT, "");
// attach the file
Uri fileURI =
FileProvider.getUriForFile(mContext, BuildConfig.APPLICATION_ID + ".provider", mFile);
emailIntent.putExtra(Intent.EXTRA_STREAM, fileURI);
getUiComponent().startActivity(Intent.createChooser(emailIntent, "Send log.."));
if (mFileWriter != null) {
try {
mFileWriter.flush();
mFileWriter.close();
mFileWriter = null;
} catch (IOException e) {
logException("Unable to close all file streams.", e);
return;
}
}
}
示例4: onCreate
import android.support.v4.BuildConfig; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Logger.setDebug(BuildConfig.DEBUG);
Logger.getDefaultLogger().i("Default Logger info");
ILogger.i("Custom Logger info");
String src = "test";
String pwd = "123456";
byte[] encrypt = DES3Coder.encryptMode(src.getBytes(), pwd);
ILogger.d("encrypt=" + HexCoder.encodeHexString(encrypt));
byte[] decrypt = DES3Coder.decryptMode(encrypt, pwd);
ILogger.d("decrypt=" + new String(decrypt));
AppCacheUtils.getInstance(this).put("myKey", "myValue");
ILogger.e(new RuntimeException("test"));
long time = 1456212309763L;
ILogger.d(DateUtils.getTimeInterval(DateUtils.format(new Date(time), "yyyy-MM-dd HH:mm:ss")));
}
示例5: isGoogleAvailable
import android.support.v4.BuildConfig; //导入依赖的package包/类
private static void isGoogleAvailable(final Callback callback) {
new Thread(new Runnable() {
@Override
public void run() {
HttpURLConnection urlConnection = null;
try {
URL url = new URL("http://maps.googleapis.com");
urlConnection = (HttpURLConnection) url.openConnection();
urlConnection.setConnectTimeout(5000);
urlConnection.connect();
callback.result(true);
} catch (IOException e) {
e.printStackTrace();
if (BuildConfig.DEBUG) Logger.log(e);
callback.result(false);
} finally {
if (urlConnection != null) urlConnection.disconnect();
}
}
}).start();
}
示例6: removeDoc
import android.support.v4.BuildConfig; //导入依赖的package包/类
/**
* Handles deleting a document in a collection.
* Override if you want to use your own collection data store.
* @param collName collection name
* @param docId document ID
* @return true if doc was deleted, false otherwise
*/
public boolean removeDoc(String collName, String docId) {
if (mCollections.containsKey(collName)) {
// remove IDs from collection
Map<String, Map<String,Object>> collection = mCollections.get(collName);
if (BuildConfig.DEBUG) {
log.debug("Removed doc: " + docId);
}
collection.remove(docId);
return true;
} else {
log.warn("Received invalid removed msg for collection "
+ collName);
return false;
}
}
示例7: addDoc
import android.support.v4.BuildConfig; //导入依赖的package包/类
/**
* Handles adding a document to collection.
* Override if you want to use your own collection data store.
* @param jsonFields fields for document
* @param collName collection name
* @param docId document ID
*/
@SuppressWarnings("unchecked")
public void addDoc(Map<String, Object> jsonFields, String collName,
String docId) {
if (!mCollections.containsKey(collName)) {
// add new collection
log.debug("Added collection " + collName);
mCollections.put(collName, new ConcurrentHashMap<String, Map<String,Object>>());
}
Map<String, Map<String,Object>> collection = mCollections.get(collName);
Map<String, Object> fields;
if(jsonFields.get(DdpMessageField.FIELDS) == null) {
fields = new ConcurrentHashMap<>();
} else {
fields = (Map<String, Object>) jsonFields.get(DdpMessageField.FIELDS);
}
collection.put(docId, fields);
if (BuildConfig.DEBUG) {
log.debug("Added docid " + docId + " to collection " + collName);
}
}
示例8: onCreate
import android.support.v4.BuildConfig; //导入依赖的package包/类
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// active StrictMode when debug
if (BuildConfig.DEBUG) {
StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder().detectAll().penaltyLog().build());
StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder().detectAll().penaltyLog().build());
}
if (this.getNavigationItemSelectedListener() != null) {
this.mNavigationView.setNavigationItemSelectedListener(this.getNavigationItemSelectedListener());
}
this.mDrawerLayout.addDrawerListener(new BaseDrawerListener());
this.mMenuItems = new ArrayMap<>();
int[] menuItemIds = this.getMenuItemIds();
if (menuItemIds.length > 0) {
for (int id : menuItemIds) {
MenuItem menuItem = this.mNavigationView.getMenu().findItem(id);
if (menuItem != null)
this.mMenuItems.put(id, menuItem);
}
}
this.mDrawerToggle = new ActionBarDrawerToggle(this,
this.mDrawerLayout,
R.string.navigation_drawer_open,
R.string.navigation_drawer_close);
View v = mNavigationView.getHeaderView(0);
mNickname = (TextView) v.findViewById(R.id.tv_name);
mSignature = (TextView) v.findViewById(R.id.tv_sign);
}
示例9: getUUID
import android.support.v4.BuildConfig; //导入依赖的package包/类
/**
* 获取全局UUID
*
* @param context 上下文容器
* @return UUID
*/
public static String getUUID(Context context) {
String uuid = null;
SharedPreferences preferences =
PreferenceManager.getDefaultSharedPreferences(context);
if (preferences != null)
uuid = preferences.getString("uuid", "");
if (TextUtils.isEmpty(uuid)) {
uuid = UUID.randomUUID().toString();
if (preferences != null)
preferences.edit().putString("uuid", uuid).commit();
}
if (BuildConfig.DEBUG) Log.d(TAG, "getUUID : " + uuid); //DEBUG
return uuid;
}
示例10: onCreate
import android.support.v4.BuildConfig; //导入依赖的package包/类
@Override
public void onCreate(final SQLiteDatabase db) {
db.execSQL(CREATE);
try {
addOrigin(db, new HttpOrigin("localhost", 80), "Manager (HTTP)", System.currentTimeMillis());
} catch (OriginDBException e) {
if (BuildConfig.DEBUG) {
Log.e("Origin", "error.");
}
}
}
示例11: onManagerEventTransmitDisconnected
import android.support.v4.BuildConfig; //导入依赖的package包/类
@Override
protected void onManagerEventTransmitDisconnected(final String origin) {
if (BuildConfig.DEBUG) {
mLogger.info("Plug-in : onManagerEventTransmitDisconnected");
}
if (origin != null) {
EventManager.INSTANCE.removeEvents(origin);
} else {
EventManager.INSTANCE.removeAll();
}
}
示例12: onDevicePluginReset
import android.support.v4.BuildConfig; //导入依赖的package包/类
@Override
protected void onDevicePluginReset() {
if (BuildConfig.DEBUG) {
mLogger.info("Plug-in : onDevicePluginReset");
}
resetPluginResource();
}
示例13: onCreate
import android.support.v4.BuildConfig; //导入依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
BlueteethManager.getInstance().initialize(this);
if (BuildConfig.DEBUG) {
Timber.plant(new DebugTree());
} else {
Timber.plant(new CrashReportingTree());
}
}
示例14: v
import android.support.v4.BuildConfig; //导入依赖的package包/类
public static void v(final String tag, String message) {
// include logging only in debug versions
if (BuildConfig.DEBUG || mTesting) {
Log.v(tag, message);
}
}
示例15: onUpgrade
import android.support.v4.BuildConfig; //导入依赖的package包/类
@Override
public final void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
if (oldVersion < LAST_DATABASE_NUKE_VERSION) {
if (BuildConfig.DEBUG) {
Timber.d(TAG + " Nuking Database. Old Version: " + oldVersion);
}
cupboard().withDatabase(db).dropAllTables();
onCreate(db);
} else {
// This will upgrade tables, adding columns and new tables.
// Note that existing columns will not be converted
cupboard().withDatabase(db).upgradeTables();
}
}