當前位置: 首頁>>代碼示例>>Java>>正文


Java Log類代碼示例

本文整理匯總了Java中org.appcelerator.kroll.common.Log的典型用法代碼示例。如果您正苦於以下問題:Java Log類的具體用法?Java Log怎麽用?Java Log使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Log類屬於org.appcelerator.kroll.common包,在下文中一共展示了Log類的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();
	}
}
 
開發者ID:chreck,項目名稱:movento-webview,代碼行數:32,代碼來源:TiWebViewClient.java

示例2: start

import org.appcelerator.kroll.common.Log; //導入依賴的package包/類
@Kroll.method
public void start()
{
    setState(STATE_RUNNING);
    // App opens analytics
    ParseAnalytics.trackAppOpenedInBackground(TiApplication.getAppRootOrCurrentActivity().getIntent());
    ParseInstallation.getCurrentInstallation().put("androidId", getAndroidId());
    ParseInstallation.getCurrentInstallation().saveInBackground(new SaveCallback() {
        public void done(ParseException e) {
            if (e != null) {
                Log.e(TAG, "Installation initialization failed: " + e.getMessage());
            }
            // fire event
            try {
            	JSONObject pnData = new JSONObject();
	pnData.put("objectId", getObjectId());
	pnData.put("installationId", getCurrentInstallationId());
	KrollDict data = new KrollDict(pnData);
             module.fireEvent("installationId", data);
} catch (JSONException e1) {
	Log.e(TAG, "InstallationId event failed: " + e1.getMessage());
}
        }
    });
}
 
開發者ID:gimdongwoo,項目名稱:Titanium-Parse-Android,代碼行數:26,代碼來源:ParseModule.java

示例3: openURL

import org.appcelerator.kroll.common.Log; //導入依賴的package包/類
@Kroll.method
public boolean openURL(KrollDict options) {
	if ( (options != null) && options.containsKeyAndNotNull(Params.URL)) {
		Context context = TiApplication.getAppCurrentActivity();
		List<ResolveInfo> browsersList = Utils.allBrowsers(context);
		
		if (!browsersList.isEmpty()) {
			List<String> customTabBrowsers = getCustomTabBrowsers(context, browsersList);				
			
			// show supported browsers list or open directly if only 1 supported browser is available
			openCustomTab(context, customTabBrowsers, options);
	        
			return true;
			
		} else {
			Log.i(Params.LCAT, "No browsers available in this device.");
			return false;
		}
	}
	
	Log.i(Params.LCAT, "Check your paramters. URL parameter is mandatory.");
	return false;
}
 
開發者ID:prashantsaini1,項目名稱:ti-chrometabs,代碼行數:24,代碼來源:TichrometabsModule.java

示例4: 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;
}
 
開發者ID:chreck,項目名稱:movento-webview,代碼行數:26,代碼來源:TiWebViewBinding.java

示例5: isHTCSenseDevice

import org.appcelerator.kroll.common.Log; //導入依賴的package包/類
private boolean isHTCSenseDevice()
{
	boolean isHTC = false;
	
	FeatureInfo[] features = TiApplication.getInstance().getApplicationContext().getPackageManager().getSystemAvailableFeatures();
	if(features == null) { 
		return isHTC;
	}
	for (FeatureInfo f : features) {
		String fName = f.name;
		if (fName != null) {
			isHTC = fName.contains("com.htc.software.Sense");
			if (isHTC) {
				Log.i(TAG, "Detected com.htc.software.Sense feature "+fName);
				break;
			}
		}
	}
	
	return isHTC;
}
 
開發者ID:chreck,項目名稱:movento-webview,代碼行數:22,代碼來源:TiUIWebView.java

示例6: reload

import org.appcelerator.kroll.common.Log; //導入依賴的package包/類
public void reload()
{
	switch (reloadMethod) {
	case DATA:
		if (reloadData != null && reloadData instanceof TiBlob) {
			setData((TiBlob) reloadData);
		} else {
			Log.d(TAG, "reloadMethod points to data but reloadData is null or of wrong type. Calling default", Log.DEBUG_MODE);
			getWebView().reload();
		}
		break;
		
	case HTML:
		if (reloadData == null || (reloadData instanceof HashMap<?,?>) ) {
			setHtml(TiConvert.toString(getProxy().getProperty(TiC.PROPERTY_HTML)), (HashMap<String,Object>)reloadData);
		} else {
			Log.d(TAG, "reloadMethod points to html but reloadData is of wrong type. Calling default", Log.DEBUG_MODE);
			getWebView().reload();
		}
		break;
	
	case URL:
		if (reloadData != null && reloadData instanceof String) {
			setUrl((String) reloadData);
		} else {
			Log.d(TAG, "reloadMethod points to url but reloadData is null or of wrong type. Calling default", Log.DEBUG_MODE);
			getWebView().reload();
		}
		break;
		
	default:
		getWebView().reload();
	}
}
 
開發者ID:chreck,項目名稱:movento-webview,代碼行數:35,代碼來源:TiUIWebView.java

示例7: onMessageReceived

import org.appcelerator.kroll.common.Log; //導入依賴的package包/類
@Override
public void onMessageReceived(String from, Bundle rawData) {
    Log.d(TAG, "Received message from: " + from);
    HashMap<String, Object> data = CttimekogcmModule.bundleToHashMap(rawData);

    boolean forceCreateNotification = false;
    if (data.containsKey("forceCreateNotification")) {
        if (data.get("forceCreateNotification").equals("true")) {
            forceCreateNotification = true;
        }
    }

    try {
        CttimekogcmModule module = CttimekogcmModule.getInstance();
        if(module != null && !forceCreateNotification) {
            if(KrollRuntime.isInitialized() && TiApplication.isCurrentActivityInForeground()) {
                module.fireMessage(data, true);
                return;
            }
        }
    } catch (Exception e) {
        Log.d(TAG, "Couldn't send fireMessage to CttimekogcmModule");
    }

    NotificationPublisher.createNotification(this, data);
}
 
開發者ID:a-voityuk,項目名稱:CTTimekoGCM,代碼行數:27,代碼來源:ListenerService.java

示例8: clearSchedule

import org.appcelerator.kroll.common.Log; //導入依賴的package包/類
@Kroll.method
public void clearSchedule() {
    TiApplication app = TiApplication.getInstance();

    int ntfCount = app.getAppProperties().getInt(PROPERTY_NOTIFICATION_COUNTER, 0);

    Log.d(TAG, "Clearing " + ntfCount + " notifications");

    if(ntfCount > 0) {
        Intent intent = new Intent(app.getApplicationContext(), NotificationPublisher.class);
        for(int i = 0; i < ntfCount; i++) {
            PendingIntent pendingIntent = PendingIntent.getBroadcast(app.getApplicationContext(), i, intent, PendingIntent.FLAG_ONE_SHOT);
            AlarmManager alarmManager = (AlarmManager)app.getApplicationContext().getSystemService(Context.ALARM_SERVICE);
            alarmManager.cancel(pendingIntent);
            pendingIntent.cancel();
        }

        app.getAppProperties().setInt(PROPERTY_NOTIFICATION_COUNTER, 0);
    }
}
 
開發者ID:a-voityuk,項目名稱:CTTimekoGCM,代碼行數:21,代碼來源:CttimekogcmModule.java

示例9: schedule

import org.appcelerator.kroll.common.Log; //導入依賴的package包/類
@Kroll.method
public void schedule(long time, HashMap data) {
    TiApplication app = TiApplication.getInstance();
    int ntfId = app.getAppProperties().getInt(PROPERTY_NOTIFICATION_COUNTER, 0);

    Log.d(TAG, "Scheduling notification " + ntfId + " at " + time);

    Intent intent = new Intent(app.getApplicationContext(), NotificationPublisher.class);
    intent.putExtra(PROPERTY_NOTIFICATION_DATA, data);
    PendingIntent pendingIntent = PendingIntent.getBroadcast(app.getApplicationContext(), ntfId, intent, PendingIntent.FLAG_ONE_SHOT);

    AlarmManager alarmManager = (AlarmManager)app.getApplicationContext().getSystemService(Context.ALARM_SERVICE);
    alarmManager.set(AlarmManager.RTC_WAKEUP, time, pendingIntent);

    app.getAppProperties().setInt(PROPERTY_NOTIFICATION_COUNTER, ntfId+1);
}
 
開發者ID:a-voityuk,項目名稱:CTTimekoGCM,代碼行數:17,代碼來源:CttimekogcmModule.java

示例10: BluetoothClientThread

import org.appcelerator.kroll.common.Log; //導入依賴的package包/類
public BluetoothClientThread(BluetoothConnection connection)
{
 super();
 Log.d(LCAT, "Creating new Client thread.");
 mConnection = connection;
 mDevice = connection.getDevice();
 try{
	 // using reflection in an effort to make it work - no different from calling createRfcommSocketToServiceRecord directly
	 Class<?> cls = Class.forName("android.bluetooth.BluetoothDevice");
	 Class<?> arg = Class.forName("java.util.UUID");
	 java.lang.reflect.Method method = cls.getMethod("createRfcommSocketToServiceRecord", new Class[]{arg});
	 mSocket = (BluetoothSocket) method.invoke(mDevice, mConnection.getServiceId().mUuid);

	 //mSocket = mDevice.createRfcommSocketToServiceRecord(mConnection.getServiceId().mUuid);
	 start();
 }
 catch(Exception e){
	 e.printStackTrace();
	 mConnection.relayError(e.getMessage());
 }
}
 
開發者ID:eyesore,項目名稱:appc-android-bluetooth,代碼行數:22,代碼來源:BluetoothClientThread.java

示例11: onReceive

import org.appcelerator.kroll.common.Log; //導入依賴的package包/類
public void onReceive(Context context, Intent intent) {
    String action = intent.getAction();
    Log.d(LCAT,  action);
    // When discovery finds a device
    if (BluetoothDevice.ACTION_FOUND.equals(action)) {
        // Get the BluetoothDevice object from the Intent
        BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
        if(device != null)
        {
        	Log.d(LCAT,  device.getName());
        	Log.d(LCAT,  "Adding device to array.");
         // Add the name and address to an array adapter to show in a ListView
         mArray[counter] = device;
         counter++;
        }
    }
}
 
開發者ID:eyesore,項目名稱:appc-android-bluetooth,代碼行數:18,代碼來源:BluetoothService.java

示例12: connectBluetooth

import org.appcelerator.kroll.common.Log; //導入依賴的package包/類
public void connectBluetooth()
 {
	if (mBluetoothAdapter == null)
	{
	    Log.d(LCAT, "********** Device does not support Bluetooth");
	    mModule.sendMessage("This device does not support bluetooth.");
	}
	else if(mBluetoothAdapter.isEnabled())
	{
	    Log.d(LCAT, "********** Bluetooth is enabled");
	    mModule.sendMessage("Bluetooth is already enabled!");
	}
	else
	{
		Log.d(LCAT, "********** Bluetooth is disabled");
		Log.d(LCAT, "********** Attempting to enable Bluetooth");
		Intent intentBluetooth = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
		intentBluetooth.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

		mContext.startActivity(intentBluetooth);
	}
}
 
開發者ID:eyesore,項目名稱:appc-android-bluetooth,代碼行數:23,代碼來源:BluetoothService.java

示例13: hasPermission

import org.appcelerator.kroll.common.Log; //導入依賴的package包/類
/**
 * check, if given permission is currently granted
 * 
 * @param requestedPermission - permission as defined in Manifest
 * @return
 */
@Kroll.method
public boolean hasPermission(@Kroll.argument() String requestedPermission) {
	Log.d(LCAT, "check for granted permission: " + requestedPermission);

	// TODO really depends on Build or Platform???
	if (Build.VERSION.SDK_INT < 23) {
		return true;
	}

	Context ctx = TiApplication.getInstance().getApplicationContext(); 
	if (ContextCompat.checkSelfPermission(ctx,
			requestedPermission) != PackageManager.PERMISSION_GRANTED) {
		return false;
	}
	return true;
}
 
開發者ID:stgrosshh,項目名稱:tipermissions,代碼行數:23,代碼來源:TipermissionsModule.java

示例14: 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);

}
 
開發者ID:stgrosshh,項目名稱:tipermissions,代碼行數:25,代碼來源:TipermissionsModule.java

示例15: 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);

	}
 
開發者ID:stgrosshh,項目名稱:tipermissions,代碼行數:29,代碼來源:TipermissionsModule.java


注:本文中的org.appcelerator.kroll.common.Log類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。