Skip to content

Instantly share code, notes, and snippets.

@milon120203
Last active November 5, 2018 19:25
Show Gist options
  • Save milon120203/e5447940f8dd089e5dc17f0bfb5f36dd to your computer and use it in GitHub Desktop.
Save milon120203/e5447940f8dd089e5dc17f0bfb5f36dd to your computer and use it in GitHub Desktop.
var win = Titanium.UI.createWindow({
title: 'HTTP Test',
backgroundColor: '#ccc'
});
// Create a Button.
var testButton = Ti.UI.createButton({
title: 'HttpTest',
height: Ti.UI.SIZE,
width: Ti.UI.SIZE,
});
function webRequestTest() {
var xhr,
queryStringValue1 = encodeURIComponent("test#1"),
queryStringValue2 = "Google Nexus 6 - 6.0.0 - API 23 - 1440x2560",
url = "http://testapi.swlbd.com/rest/appusers/login/?id="+ queryStringValue1 +"&value=" + queryStringValue2;
xhr = Ti.Network.createHTTPClient();
xhr.open("GET", url);
xhr.setRequestHeader('Content-Type', 'application/json');
xhr.setRequestHeader('WWW-Authentication', 'BASIC');
xhr.setRequestHeader('Authorization', 'Basic ');
xhr.onload = function() {
if (this.status == "200") {
Ti.API.info("successful");
Ti.API.info(this.responseText);
} else {
Ti.API.info(this.status + " " + this.response);
}
};
xhr.onerror = function(e) {
Ti.API.info(e.error);
};
xhr.send();
};
// Listen for click events.
testButton.addEventListener('click', function() {
webRequestTest();
});
// Add to the parent view.
win.add(testButton);
win.open();
// alert('hi1')
Operating System
Name = Microsoft Windows 8.1 Pro with Media Center
Version = 6.3.9600
Architecture = 64bit
# CPUs = 4
Memory = 6298132480
Node.js
Node.js Version = 8.9.1
npm Version = 5.5.1
Titanium CLI
CLI Version = 5.1.1
Titanium SDK
SDK Version = 7.4.1.GA
SDK Path = C:\ProgramData\Titanium\mobilesdk\win32\7.4.1.GA
Target Platform = android
-- Start application log -----------------------------------------------------
[INFO] : Project built successfully in 3m 50s 172ms
[ERROR] : Zygote: v2
[INFO] : SELinux: SELinux: seapp_context_lookup: seinfo=untrusted, level=s0:c512,c768, pkgname=com.ex.TextfieldFocus
[INFO] : TiApplication: (main) [0,0] checkpoint, app created.
[INFO] : TiApplication: (main) [93,93] Titanium 7.4.0 (2018/09/13 11:40 undefined)
[ERROR] : Zygote: accessInfo : 0
[WARN] : SELinux: SELinux selinux_android_compute_policy_index : Policy Index[2], Con:u:r:zygote:s0 RAM:SEPF_SECMOBILE_7.0_0010, [-1 -1 -1 -1 0 1]
[WARN] : art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
[INFO] : MultiDex: VM with version 2.1.0 has multidex support
[INFO] : MultiDex: Installing application
[INFO] : MultiDex: VM has multidex support, MultiDex support library is disabled.
[INFO] : art: Background sticky concurrent mark sweep GC freed 21394(1281KB) AllocSpace objects, 11(316KB) LOS objects, 20% free, 3MB/4MB, paused 1.682ms total 107.983ms
[INFO] : TiApplication: (main) [2123,2216] Titanium Javascript runtime: v8
[INFO] : TiRootActivity: (main) [0,0] checkpoint, on root activity create, savedInstanceState: null
[INFO] : I/System.out: (HTTPLog)-Static: isSBSettingEnabled false
[INFO] : I/System.out: (HTTPLog)-Static: isSBSettingEnabled false
[LiveView] Client connected
[INFO] : I/System.out: (HTTPLog)-Static: isSBSettingEnabled false
[INFO] : I/System.out: (HTTPLog)-Static: isSBSettingEnabled false
[INFO] : TiRootActivity: (main) [0,0] checkpoint, on root activity resume. activity = com.ex.TextfieldFocus.TextfieldfocusActivity@3f45fc6
[INFO] : InputMethodManager: HSI ignore mServedView == null or mServedView.getWindowToken() != windowToken, mServedView :0
[INFO] : OpenGLRenderer: Initialized EGL, version 1.4
[INFO] : InputMethodManager: [IMM] startInputInner - mService.startInputOrWindowGainedFocus
[INFO] : I/InputDispatcher( 2849): Delivering touch to : action: 0x0, toolType: 1
[ERROR] : BoostFramework: BoostFramework() : Exception_1 = java.lang.ClassNotFoundException: Didn't find class "com.qualcomm.qti.Performance" on path: DexPathList[[],nativeLibraryDirectories=[/system/lib, /vendor/lib]]
[INFO] : I/InputDispatcher( 2849): Delivering touch to : action: 0x1, toolType: 1
[INFO] : I/System.out: (HTTPLog)-Static: isSBSettingEnabled false
[INFO] : I/System.out: (HTTPLog)-Static: isSBSettingEnabled false
[INFO] : successful
[INFO] : {"error":true,"success":false,"message":{"id":"test#1","value":"Google Nexus 6 - 6.0.0 - API 23 - 1440x2560","headers":false}}
[INFO] : APSAnalyticsRunnable: Analytics Started
[INFO] : I/System.out: (HTTPLog)-Static: isSBSettingEnabled false
[INFO] : I/System.out: (HTTPLog)-Static: isSBSettingEnabled false
[INFO] : APSAnalyticsRunnable: Stopping Service
[INFO] : I/InputDispatcher( 2849): Delivering touch to : action: 0x0, toolType: 1
[INFO] : I/InputDispatcher( 2849): Delivering touch to : action: 0x1, toolType: 1
[INFO] : I/System.out: (HTTPLog)-Static: isSBSettingEnabled false
[INFO] : I/System.out: (HTTPLog)-Static: isSBSettingEnabled false
[INFO] : I/System.out: (HTTPLog)-Static: isSBSettingEnabled false
[INFO] : I/System.out: (HTTPLog)-Static: isSBSettingEnabled false
[INFO] : successful
[INFO] : {"error":true,"success":false,"message":{"id":"test#1","value":"Google Nexus 6 - 6.0.0 - API 23 - 1440x2560","headers":false}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment