本文整理匯總了Java中org.appcelerator.kroll.common.Log.e方法的典型用法代碼示例。如果您正苦於以下問題:Java Log.e方法的具體用法?Java Log.e怎麽用?Java Log.e使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.appcelerator.kroll.common.Log
的用法示例。
在下文中一共展示了Log.e方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onReceivedSslError
import org.appcelerator.kroll.common.Log; //導入方法依賴的package包/類
@Override
public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error)
{
/*
* in theory this should be checked to make sure it's not null but if there is some failure
* in the association then usage of webViewProxy should trigger a NPE to make sure the issue
* is not ignored
*/
KrollProxy webViewProxy = this.webView.getProxy();
KrollDict data = new KrollDict();
data.put(TiC.ERROR_PROPERTY_CODE, error.getPrimaryError());
webView.getProxy().fireSyncEvent(TiC.EVENT_SSL_ERROR, data);
boolean ignoreSslError = false;
try {
ignoreSslError = webViewProxy.getProperties().optBoolean(TiC.PROPERTY_WEBVIEW_IGNORE_SSL_ERROR, false);
} catch(IllegalArgumentException e) {
Log.e(TAG, TiC.PROPERTY_WEBVIEW_IGNORE_SSL_ERROR + " property does not contain a boolean value, ignoring");
}
if (ignoreSslError == true) {
Log.w(TAG, "ran into SSL error but ignoring...");
handler.proceed();
} else {
Log.e(TAG, "SSL error occurred: " + error.toString());
handler.cancel();
}
}
示例2: getJSValue
import org.appcelerator.kroll.common.Log; //導入方法依賴的package包/類
synchronized public String getJSValue(String expression)
{
// Don't try to evaluate js code again if the binding has already been destroyed
if (!destroyed && interfacesAdded) {
String code = "_TiReturn.setValue((function(){try{return " + expression
+ "+\"\";}catch(ti_eval_err){return '';}})());";
Log.d(TAG, "getJSValue:" + code, Log.DEBUG_MODE);
returnSemaphore.drainPermits();
synchronized (codeSnippets) {
codeSnippets.push(code);
}
try {
if (!returnSemaphore.tryAcquire(3500, TimeUnit.MILLISECONDS)) {
synchronized (codeSnippets) {
codeSnippets.removeElement(code);
}
Log.w(TAG, "Timeout waiting to evaluate JS");
}
return returnValue;
} catch (InterruptedException e) {
Log.e(TAG, "Interrupted", e);
}
}
return null;
}
示例3: requestPermission
import org.appcelerator.kroll.common.Log; //導入方法依賴的package包/類
/**
* Request a permission and optionally register a callback for the current activity
*
* @param requestedPermission permission as defined in Manifest
* @param permissionCallback function called with result of permission prompt
* @param requestCode - 8 Bit value to associate callback with request - if none is provided a system generated will used
* @return true in case of valid request, false if requested permission is not a valid one
*/
@Kroll.method
public boolean requestPermission(String requestedPermission,
@Kroll.argument(optional = true) KrollFunction permissionCallback,
@Kroll.argument(optional = true) Integer requestCode) {
Log.d(LCAT, "Requesting permission: " + requestedPermission);
if (!isValidPermissionString(requestedPermission)) {
Log.e(LCAT, "Requested permission is not supported :"
+ requestedPermission);
return false;
}
return handleRequest(new String[]{requestedPermission}, requestCode, permissionCallback);
}
示例4: requestPermissions
import org.appcelerator.kroll.common.Log; //導入方法依賴的package包/類
/**
* Request a permission and optionally register a callback for the current activity
*
* @param requestedPermissions Array of permissions as defined in Manifest
* @param permissionCallback function called with result of permission prompt
* @param requestCode - 8 Bit value to associate callback with request - if none is provided, a system generated one is used
* @return true in case of valid request, false if requested permission is not a valid one
*/
@Kroll.method
public boolean requestPermissions(@Kroll.argument String[] requestedPerms,
@Kroll.argument(optional = true) KrollFunction permissionCallback,
@Kroll.argument(optional = true) Integer requestCode)
{
// String[] requestedPermissions = new String[]{requestedPerms};//(String[])requestedPerms;
for(String permission:requestedPerms) {
Log.d(LCAT, "Requesting permission: " + permission);
if (!isValidPermissionString(permission)) {
Log.e(LCAT, "Requested permission is not supported :"
+ permission);
return false;
}
}
return handleRequest(requestedPerms, requestCode, permissionCallback);
}
示例5: EnablePush
import org.appcelerator.kroll.common.Log; //導入方法依賴的package包/類
public static void EnablePush(TiApplication app) {
Context appContext = app.getApplicationContext();
Activity appActivity = app.getAppCurrentActivity();
if (appContext == null) {
Log.e(TAG, "Application context is null, can't initialize Parse");
return;
}
else if (appActivity == null) {
Log.e(TAG, "Application activity is null, can't initialize Parse");
return;
}
else {
//PushService.setDefaultPushCallback(appContext, appActivity.getClass());
ParseAnalytics.trackAppOpened(appActivity.getIntent());
ParseInstallation.getCurrentInstallation().saveInBackground();
}
}
示例6: getResource
import org.appcelerator.kroll.common.Log; //導入方法依賴的package包/類
private int getResource(String type, String name) {
int icon = 0;
if (name != null) {
/* Remove extension from icon */
int index = name.lastIndexOf(".");
if (index > 0) {
name = name.substring(0, index);
}
try {
icon = TiRHelper.getApplicationResource(type + "." + name);
} catch (TiRHelper.ResourceNotFoundException ex) {
Log.e(LCAT, type + "." + name + " not found; make sure it's in platform/android/res/" + type);
}
}
return icon;
}
示例7: setIcon
import org.appcelerator.kroll.common.Log; //導入方法依賴的package包/類
@Kroll.method @Kroll.setProperty
public void setIcon(Object icon)
{
if (icon instanceof Number) {
notificationBuilder.setSmallIcon(((Number)icon).intValue());
} else {
String iconUrl = TiConvert.toString(icon);
if (iconUrl == null) {
Log.e(TAG, "Url is null");
return;
}
String iconFullUrl = resolveUrl(null, iconUrl);
notificationBuilder.setSmallIcon(TiUIHelper.getResourceId(iconFullUrl));
}
setProperty(TiC.PROPERTY_ICON, icon);
}
示例8: getImage
import org.appcelerator.kroll.common.Log; //導入方法依賴的package包/類
@Kroll.method
public TiBlob getImage(String filePath) {
filePath = filePath.replaceFirst("file://", "");
if (null != filePath) {
return TiBlob.blobFromImage( BitmapFactory.decodeFile(filePath) );
}
Log.e(Defaults.LCAT, "File path missing");
return null;
}
示例9: InitializeParse
import org.appcelerator.kroll.common.Log; //導入方法依賴的package包/類
public void InitializeParse(String appId, String clientKey, TiApplication application) {
Context appContext = application.getApplicationContext();
if (appContext == null) {
Log.e(TAG, "Application context is null, cannot continue...");
return;
}
else if (appId != null && appId.isEmpty()) {
Log.e(TAG, "Application key is required! Parse has NOT been initialized.");
return;
}
else if (clientKey != null && clientKey.isEmpty()) {
Log.e(TAG, "Client key is required! Parse has NOT been initialized.");
return;
}
if (!initialized) {
Log.d(TAG, "Initializing with: '" + appId + "' and '" + clientKey + "'.");
Parse.initialize(appContext, appId, clientKey);
initialized = true;
}
else
{
Log.e(TAG, "Parse has already been initialized!");
}
}
示例10: InitializeParseWithConfig
import org.appcelerator.kroll.common.Log; //導入方法依賴的package包/類
public void InitializeParseWithConfig(String appId, String clientKey, String serverUrl, TiApplication application) {
Context appContext = application.getApplicationContext();
if (appContext == null) {
Log.e(TAG, "Application context is null, cannot continue...");
return;
} else if (appId != null && appId.isEmpty()) {
Log.e(TAG, "Application key is required! Parse has NOT been initialized.");
return;
} else if (serverUrl != null && serverUrl.isEmpty()) {
Log.e(TAG, "Server Url is required! Parse has NOT been initialized.");
return;
}
if (!initialized) {
Log.d(TAG, "Initializing with: '" + appId + "' and '" + serverUrl + "'.");
Parse.initialize(new Parse.Configuration.Builder(appContext)
.applicationId(appId)
.clientKey(null)
.server(serverUrl)
.build());
initialized = true;
}
else
{
Log.e(TAG, "Parse has already been initialized!");
}
}
示例11: onError
import org.appcelerator.kroll.common.Log; //導入方法依賴的package包/類
@Override
public void onError(Context context, String errorId) {
Log.e(LCAT, "Error: " + errorId);
if (GCMModule.getInstance() != null) {
GCMModule.getInstance().sendError(errorId);
}
}
示例12: onRecoverableError
import org.appcelerator.kroll.common.Log; //導入方法依賴的package包/類
@Override
public boolean onRecoverableError(Context context, String errorId) {
Log.e(LCAT, "RecoverableError: " + errorId);
if (GCMModule.getInstance() != null) {
GCMModule.getInstance().sendError(errorId);
}
return true;
}
示例13: setSound
import org.appcelerator.kroll.common.Log; //導入方法依賴的package包/類
@Kroll.method @Kroll.setProperty
public void setSound(String url)
{
if (url == null) {
Log.e(TAG, "Url is null");
return;
}
sound = Uri.parse(resolveUrl(null, url));
notificationBuilder.setSound(sound, audioStreamType);
setProperty(TiC.PROPERTY_SOUND, url);
}
示例14: unsubscribe
import org.appcelerator.kroll.common.Log; //導入方法依賴的package包/類
@Kroll.method
public void unsubscribe(final HashMap options) {
// unsubscripe from a topic
final String senderId = (String) options.get("senderId");
final String topic = (String) options.get("topic");
final KrollFunction callback = (KrollFunction) options.get("callback");
if (topic == null || !topic.startsWith("/topics/")) {
Log.e(LCAT, "No or invalid topic specified, should start with /topics/");
}
if (senderId != null) {
new AsyncTask<Void, Void, Void>() {
@Override
protected Void doInBackground(Void... params) {
try {
String token = getToken(senderId);
if (token != null) {
GcmPubSub.getInstance(TiApplication.getInstance()).unsubscribe(token, topic);
if (callback != null) {
// send success callback
HashMap<String, Object> data = new HashMap<String, Object>();
data.put("success", true);
data.put("topic", topic);
data.put("token", token);
callback.callAsync(getKrollObject(), data);
}
} else {
sendError(callback, "Cannot unsubscribe from topic " + topic);
}
} catch (Exception ex) {
sendError(callback, "Cannot unsubscribe from topic " + topic + ": " + ex.getMessage());
}
return null;
}
}.execute();
}
}
示例15: sendError
import org.appcelerator.kroll.common.Log; //導入方法依賴的package包/類
public void sendError(KrollFunction callback, String error) {
Log.e(LCAT, error);
if (callback != null) {
HashMap<String, Object> data = new HashMap<String, Object>();
data.put("success", false);
data.put("error", error);
callback.callAsync(getKrollObject(), data);
}
}