本文整理匯總了Java中org.appcelerator.kroll.common.Log.d方法的典型用法代碼示例。如果您正苦於以下問題:Java Log.d方法的具體用法?Java Log.d怎麽用?Java Log.d使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.appcelerator.kroll.common.Log
的用法示例。
在下文中一共展示了Log.d方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: 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++;
}
}
}
示例2: 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();
}
}
示例3: 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);
}
示例4: 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);
}
}
示例5: 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);
}
}
示例6: 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);
}
示例7: 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());
}
}
示例8: onAppCreate
import org.appcelerator.kroll.common.Log; //導入方法依賴的package包/類
@Kroll.onAppCreate
public static void onAppCreate(TiApplication app)
{
String appId = TiApplication.getInstance().getAppProperties().getString(ParseModule.PROPERTY_APP_ID, "");
String clientKey = TiApplication.getInstance().getAppProperties().getString(ParseModule.PROPERTY_CLIENT_KEY, "");
String serverUrl = TiApplication.getInstance().getAppProperties().getString(ParseModule.PROPERTY_SERVER_URL, "");
Log.d(TAG, "Initializing with: " + appId + ", " + clientKey + ", " + serverUrl);
Parse.initialize(new Parse.Configuration.Builder(TiApplication.getInstance())
.applicationId(appId)
.clientKey(clientKey)
.server(serverUrl + "/") // The trailing slash is important.
.build()
);
}
示例9: interceptOnBackPressed
import org.appcelerator.kroll.common.Log; //導入方法依賴的package包/類
public boolean interceptOnBackPressed()
{
if (mCustomView != null) {
onHideCustomView();
if (Log.isDebugModeEnabled()) {
Log.d(TAG, "WebView intercepts the OnBackPressed event to close the full-screen video.");
}
return true;
}
return false;
}
示例10: getServiceList
import org.appcelerator.kroll.common.Log; //導入方法依賴的package包/類
public void getServiceList(String deviceAddress)
{
BluetoothDevice device = mBluetoothAdapter.getRemoteDevice(deviceAddress);
Log.d(LCAT, device.getName());
try{
String[] services = getServiceDescriptions(servicesFromDevice(device));
mModule.servicesFound(services);
}
catch(Exception e)
{
e.printStackTrace();
mModule.sendError(e.getMessage());
}
}
示例11: onAppCreate
import org.appcelerator.kroll.common.Log; //導入方法依賴的package包/類
@Kroll.onAppCreate
public static void onAppCreate(TiApplication app)
{
Log.d(TAG, "inside onAppCreate");
if(!app.getAppProperties().hasProperty(PROPERTY_NOTIFICATION_COUNTER)) {
app.getAppProperties().setInt(PROPERTY_NOTIFICATION_COUNTER, 0);
}
}
示例12: fireMessage
import org.appcelerator.kroll.common.Log; //導入方法依賴的package包/類
public void fireMessage(HashMap<String, Object> message, boolean appInForeground) {
try {
Log.d(TAG, "Fire message callback");
if(messageCallback != null) {
HashMap<String, Object> push = new HashMap<String, Object>();
push.put("appInForeground", appInForeground);
push.put(KEY_DATA, message);
messageCallback.call(getKrollObject(), push);
Log.d(TAG, "onMessage was called");
}
} catch (Exception e) {
Log.d(TAG, "Couldn't send fireMessage");
}
}
示例13: abortPairing
import org.appcelerator.kroll.common.Log; //導入方法依賴的package包/類
public void abortPairing()
{
Log.d(LCAT, "Aborting pair process");
try {
mServerSocket.close();
}
catch(IOException e){
e.printStackTrace();
mConnection.relayError(e.getMessage());
}
Log.d(LCAT, "Pairing aborted.");
}
示例14: handleRequest
import org.appcelerator.kroll.common.Log; //導入方法依賴的package包/類
private boolean handleRequest(String[] permissions, Integer requestCode, KrollFunction permissionCallback) {
Activity activity = TiApplication.getAppCurrentActivity();
if (!(activity instanceof TiBaseActivity)) {
Log.w(LCAT, "Requesting permission from non-Titanium activity - not supported");
return false;
}
TiBaseActivity currentActivity = (TiBaseActivity) activity;
// Do we need a callback and request code in any case?
if (requestCode == null) {
Log.d(LCAT, "No request code given - Ti Permissions module will generate one");
requestCode = currentActivity.getUniqueResultCode();
}
// register callback in current activity
// TODO what is the exact purpose of the context? We should provide the Activity's Proxy, not the module object
KrollObject context = currentActivity.getActivityProxy().getKrollObject();
Log.d(LCAT, "Registering callback");
currentActivity.registerPermissionRequestCallback(requestCode,
permissionCallback, context,permissions);
Log.d(LCAT, "Calling permission request");
ActivityCompat.requestPermissions(activity, permissions, requestCode);
return true;
}
示例15: startMessaging
import org.appcelerator.kroll.common.Log; //導入方法依賴的package包/類
@Kroll.method
public void startMessaging(String apiKey,String url,String projectID) {
Log.d(LCAT, "Start Messaging called");
Countly.sharedInstance()
.init(TiApplication.getAppCurrentActivity(),url, apiKey, null, DeviceId.Type.ADVERTISING_ID)
.initMessaging(TiApplication.getAppCurrentActivity(), TiApplication.getAppRootOrCurrentActivity().getClass(), projectID, Countly.CountlyMessagingMode.PRODUCTION);
Countly.sharedInstance().onStart();
}
開發者ID:dieskim,項目名稱:countly-sdk-appcelerator-titanium-android,代碼行數:12,代碼來源:TitaniumCountlyAndroidMessagingModule.java