skip to main |
skip to sidebar
RSS Feeds
Nope. nothing .. just some random thoughts come to my mind ...
Nope. nothing .. just some random thoughts come to my mind ...
9:13 PM | Monday, February 12, 2018
Posted by harshadura
5:41 PM | Sunday, June 9, 2013
Posted by harshadura
Whoever getting started to learn Web services - Android app interaction I hope this tutorial may be helpful, You can download the full source from here: https://github.com/harshadura/RDA-Android-ASP.WS-interact/archive/master.zip
Prerequisites:
.NET framework, SQL server 2008, Android device/emulator
How to run.
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Services; using System.Data; using System.Data.Sql; using System.Data.SqlClient; [WebService(Namespace = "http://tempuri.org/")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class Service : System.Web.Services.WebService
{
public Service () {
//Uncomment the following line if using designed components
//InitializeComponent();
}
[WebMethod]
public String GetEmployeeByID(String id) {
DataSet2TableAdapters.EmployeeTableAdapter dt1 = new DataSet2TableAdapters.EmployeeTableAdapter();
String ename = "" + dt1.getEmpByID(id);
return ename;
}
[WebMethod]
public Employee[] GetEmployees()
{
var employees = new List();
try
{
string connect = @"Data Source=HARSHADURA-AZUS\SQLEXPRESS;Initial Catalog=RDA;Integrated Security=True";
string query = "SELECT eid, ename FROM Employee";
SqlConnection thisConnection = new SqlConnection(connect);
thisConnection.Open();
SqlCommand thisCommand = thisConnection.CreateCommand();
thisCommand.CommandText = query;
SqlDataReader thisReader = thisCommand.ExecuteReader();
while (thisReader.Read())
{
var emp = new Employee();
emp.eid = thisReader["eid"].ToString();
emp.ename = thisReader["ename"].ToString();
employees.Add(emp);
}
thisReader.Close();
thisConnection.Close();
}
catch (SqlException e)
{
Console.WriteLine(e.Message);
}
return employees.ToArray();
}
}
private SoapObject result = null;
private static String SOAP_ACTION = "http://tempuri.org/GetEmployeeByID";
private static String NAMESPACE = "http://tempuri.org/";
private static String METHOD_NAME = "GetEmployeeByID";
private static String URL = "http://192.168.123.100:8080/Service.asmx?WSDL";
public void connectSOAP(String empid) {
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
request.addProperty("id", empid);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(request);
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
try {
androidHttpTransport.call(SOAP_ACTION, envelope);
} catch (Exception e) {
e.printStackTrace();
}
result = (SoapObject) envelope.bodyIn;
}
9:59 PM | Wednesday, May 1, 2013
Posted by harshadura
Finally i was able to blink a LED on my Arduino through an Android app. Well! it was a really glad moment for me. :-D
11:21 AM | Friday, December 21, 2012
Posted by harshadura

12:48 AM | Thursday, November 8, 2012
Posted by harshadura
Tether your phone to your computer.
You will find the option to create a "portable WiFi hotspot". This
will be in the options, under "wireless connections" "internet" or
"tethering" (it depends on what version of android you have). Once you
have turned on the hotspot (you can use the default name and no
password, or press "settings" to configure it), you connect to your
phone from your PC as you would to any other hotspot.
EDIT: If your phone cannot make a hotspot (it seems the HTC Hero cannot) you have two options:
1) if your phone is rooted, install WiFiTether (code.google.com/p/android-wifi-tether/)
2) if you are running Windows Vista/7, install Connectify (connectify.me)
to turn your PC into a hotspot, and then connect to it with your phone.
You will find the phone's IP in Connectify's list of connected clients.
Once you're connected, make sure to set your firewall to allow
connections to and from other computers in the network (I don't know how
to use your firewall, but if you're running Windows Vista or 7, make
sure to set it as a "home" network).
And you're done. Your phone's IP address can be found by going to
"network connections" (in network & sharing centre in Vista & 7)
and looking at the status of the WiFi adaptor. It will be the IP
address labelled "default gateway".
Ref: http://superuser.com/questions/451993/connect-pc-to-an-android-device-without-external-router
8:39 AM | Thursday, October 25, 2012
Posted by harshadura
adb shell # cd /sdcard/clockworkmod/backup/2010-06-29.20.22.53 # rm nandroid.md5 # md5sum *img > nandroid.md5
c8833ba3d5307b22805daec2a1a34500 << Calculated values | boot.img
01b6cccfb42bd4e3864387eb34a14f1e data.ext4.tar
96995b58d4cbf6aaa9041b4f00c7f6ae recovery.img
dae1832a031157156269d814a0ddacee system.ext4.tar
8:32 AM | Tuesday, October 23, 2012
Posted by harshadura


------------------------------------------------- Ralapanawa.Mobile.Module - README ------------------------------------------------- Android Derivative of the Ralapanawa Centralized Web Service Released Under: MIT License 2012 Harsha Siriwardena @authors: harshadura, dewmal Download App from Google Play Market: https://play.google.com/store/apps/details?id=org.ralapanawa.mobile.android For more info visit project blog: http://www.ralapanawa.org/

3:41 PM | Saturday, August 25, 2012
Posted by harshadura

unzip -x dex2jar-version.zip -d /home/panxiaobo
linux sh /home/panxiaobo/dex2jar-version/dex2jar.sh /home/panxiaobo/someApk.apk windows C:\dex2jar-version\dex2jar.bat someApk.apk
1:12 PM | Wednesday, August 1, 2012
Posted by harshadura

7:43 PM | Monday, July 16, 2012
Posted by harshadura
Directory “c:/wamp/www/”Find and replace ’127.0.0.1′ with ‘All’
#
# Possible values for the Options directive are “None”, “All”,
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that “MultiViews” must be named *explicitly* — “Options All”
# doesn’t give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be “All”, “None”, or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride all
#
# Controls who can get stuff from this server.
#
# onlineoffline tag – don’t remove
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
10:46 AM | Sunday, May 27, 2012
Posted by harshadura
11:03 PM | Friday, May 25, 2012
Posted by harshadura
6:45 AM | Sunday, May 6, 2012
Posted by harshadura
6:30 PM | Tuesday, March 6, 2012
Posted by harshadura
------------------------------------ SimpleLocalizedAndroidApp v1.0 ------------------------------------ WTFPL - Do What The Fuck You Want To Public License xD Original Coder : @geniustd | Ref[R] Modified By : @harshadura Last Modified : 03-03-2012 [R] http://tharindudassanayake.wordpress.com/2012/02/25/use-sinhala-fonts-for-your-android-app ------------------------------------ Few Notes ------------------------------------ * You can use this[1] UCSC converter to convert unicode font into ttf related codes which are using in the xml view. ex: "wessa" > jeiai "jeiai" is the text you have to put into xml, that will result in "wessa" as output. [1] http://www.ucsc.cmb.ac.lk/ltrl/services/feconverter/?maps=s_dlm-u.xml * You can use any Sinhala unicode supported font instead of using "amal.ttf" font. (in case if you dont like that font style) * No need of Tamil fonts cause Tamil unicode is already consist with Android. (South indians developers might rocking huh!) Cheers! happy localizings! Regards, @harshadura
6:09 PM | Tuesday, February 21, 2012
Posted by harshadura
6:47 PM | Saturday, February 4, 2012
Posted by harshadura
Hi Guys!
After lot of effort I have completed one of the tutorials regarding KSOAP Web Services with Android. :D
So I would like to describe how I have solved the things for any case some one will get the use and well for my future reference as well.
package com.pxr.tutorial.soap.weather;
import org.ksoap2.SoapEnvelope;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.ksoap2.transport.HttpTransportSE;
import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
public class Main extends Activity {
private static String SOAP_ACTION = "http://tempuri.org/HelloWorld";
private static String NAMESPACE = "http://tempuri.org/";
private static String METHOD_NAME = "HelloWorld";
private static String URL = "http://bimbim.in/Sample/TestService.asmx?WSDL";
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
//Initialize soap request + add parameters
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
request.addProperty("Parameter","Value");
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.setOutputSoapObject(request);
// Make the soap call.
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
try {
//this is the actual part that will call the webservice
androidHttpTransport.call(SOAP_ACTION, envelope);
} catch (Exception e) {
e.printStackTrace();
}
// Get the SoapResult from the envelope body.
SoapObject result = (SoapObject)envelope.bodyIn;
if(result != null){
TextView t = (TextView)this.findViewById(R.id.resultbox);
t.setText("SOAP response:\n\n" + result.getProperty(0).toString());
}
}
}
package com.harshadura.img_wsdl;
import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStream;
import org.ksoap2.SoapEnvelope;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.ksoap2.transport.HttpTransportSE;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
import android.util.Base64;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
public class Main extends Activity {
ImageView image;
String extStorageDirectory;
Bitmap decodedByte;
private int iterator = 0;
Button btnStartProgress;
ProgressDialog progressBar;
private int progressBarStatus = 0;
private Handler progressBarHandler = new Handler();
private static String SOAP_ACTION = "http://tempuri.org/TestMethod";
private static String NAMESPACE = "http://tempuri.org/";
private static String METHOD_NAME = "TestMethod";
private static String URL = "http://test.org/ws/testService.asmx?WSDL";
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Button buttonDownload = (Button) findViewById(R.id.downloadImages);
Button buttonDisplay = (Button) findViewById(R.id.displayImages);
buttonDownload.setOnClickListener(buttonSaveOnClickListener);
buttonDisplay.setOnClickListener(buttonDisplayClickListener);
createDirIfNotExists("MyImages");
extStorageDirectory = Environment.getExternalStorageDirectory()
.toString() + "/MyImages/";
Log.v("path", extStorageDirectory);
}
public int doSomeTasks() {
String[] imageIDs = { "123", "124", "125" };
while (iterator < imageIDs.length) {
getEncodedImageFromService(imageIDs[iterator]);
switch (iterator) {
case 1:
return 10;
case 2:
return 20;
case 3:
return 30;
case 4:
return 40;
case 5:
return 50;
case 6:
return 60;
case 7:
return 70;
case 8:
return 80;
case 9:
return 90;
case 10:
return 100;
}
}
return 100;
}
public static boolean createDirIfNotExists(String path) {
boolean ret = true;
File file = new File(Environment.getExternalStorageDirectory(), path);
if (!file.exists()) {
if (!file.mkdirs()) {
Log.e("TravellerLog :: ", "Problem creating Image folder");
ret = false;
}
}
return ret;
}
Button.OnClickListener buttonDisplayClickListener = new Button.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(Main.this, ImageGallery.class);
startActivity(intent);
}
};
Button.OnClickListener buttonSaveOnClickListener = new Button.OnClickListener() {
@Override
public void onClick(View v) {
progressBar = new ProgressDialog(v.getContext());
progressBar.setCancelable(true);
progressBar.setMessage("Retrieving Data...");
progressBar.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
progressBar.setProgress(0);
progressBar.setMax(100);
progressBar.show();
progressBarStatus = 0;
new Thread(new Runnable() {
public void run() {
while (progressBarStatus < 100) {
progressBarStatus = doSomeTasks();
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
progressBarHandler.post(new Runnable() {
public void run() {
progressBar.setProgress(progressBarStatus);
}
});
}
if (progressBarStatus >= 100) {
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
e.printStackTrace();
}
iterator = 0;
progressBar.dismiss();
}
}
}).start();
}
};
public void getEncodedImageFromService(String imageID) {
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
request.addProperty("ImageId", imageID);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(request);
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
try {
androidHttpTransport.call(SOAP_ACTION, envelope);
} catch (Exception e) {
e.printStackTrace();
}
SoapObject result;
result = (SoapObject) envelope.bodyIn;
if (result != null) {
String encodedImage = result.getProperty(0).toString();
Log.v("TAG", encodedImage);
byte[] decodedString = Base64.decode(encodedImage, Base64.DEFAULT);
decodedByte = BitmapFactory.decodeByteArray(decodedString, 0,
decodedString.length);
SaveToSDCard();
}
}
public void SaveToSDCard() {
String imagename = "image" + (iterator + 1) + ".png";
OutputStream outStream = null;
File file = new File(extStorageDirectory, imagename);
try {
outStream = new FileOutputStream(file);
decodedByte.compress(Bitmap.CompressFormat.PNG, 100, outStream);
outStream.flush();
outStream.close();
} catch (Exception e) {
e.printStackTrace();
}
iterator++;
}
}
5:51 PM | Sunday, January 8, 2012
Posted by harshadura
This is an amazing news for the Android users because now you can
capturing screenshots & record video of Android Phones very easily. I
found this article on technospot.net. So thanks for sharing this steps.
And they have tested on Motorola Milestone an Android based smartphone.
You can also try it on your Android powered device. So check this out
bellow.
6:34 PM | Monday, January 2, 2012
Posted by harshadura
8:26 PM | Saturday, December 24, 2011
Posted by harshadura
[harshadura@localhost rules.d]$ lsusb Bus 007 Device 002: ID 04e8:685e Samsung Electronics Co., Ltd Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 006 Device 004: ID 09da:000a A4 Tech Co., Ltd Port Mouse Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 005 Device 014: ID 1c9e:6061 Bus 005 Device 002: ID 08ff:2580 AuthenTec, Inc. AES2501 Fingerprint Sensor Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub [harshadura@localhost rules.d]$
[harshadura@localhost /]$ cd /etc/udev/rules.d/ [harshadura@localhost rules.d]$ [harshadura@localhost rules.d]$ ls 10-vboxdrv.rules 56-hpmud_support.rules 70-persistent-cd.rules 85-pcscd_ccid.rules 90-hal.rules 99-fuse.rules 40-hplip.rules 60-fprint-autosuspend.rules 70-persistent-net.rules 90-alsa.rules 91-drm-modeset.rules 99-gpsd.rules 51-android.rules 60-sysprof.rules 80-kvm.rules 90-alsa-tools-firmware.rules 97-bluetooth-serial.rules [harshadura@localhost rules.d]$ [harshadura@localhost rules.d]$ vi 51-android.rules
SUBSYSTEM=="usb", SYSFS{idVendor}=="04E8", MODE="0666"
10:50 AM | Tuesday, December 20, 2011
Posted by harshadura
If you are like me and like developing in Linux, then you will find
this guide useful. When I was setting up everything for my Android
development, I ran into the problem that Linux was not recognizing my
Android phone, and took me some time figuring out how to make Linux
recognize my phone. Finally, after some research I was able to put this
little guide together and decided to share it with the rest of the
world.
ADB (Android Debug Bridge) is a handy tool that comes with Android
SDK that allows you to control and interface with your Android device.
Update: 02/04/11 – HTC changed its Vendor ID, older phones have different ID than newer phones. Refer to USB Vendor IDs table at the bottom of this tutorial to see the change.
Update: 01/02/11 – By mistake I had linked the ADB tool for OSX in step 3.1. Now it should be the correct one for Linux.
IMPORTANT Update 12/11/10 – There has been a change to
the new Android SDK. ADB Tool has been moved to
/android-sdk-linux_x86/plataform-tools, so if you have the old SDK,
please download the new one and update your path (Step 9.2 of this
tutorial). If this is your first time doing this, then disregard the
update and continue with the tutorial.
Update: 09/21/10 – Working code with Ubuntu Lucid Lynx and added more USB vendor IDs.
sudo gedit /etc/udev/rules.d/##-android.rules then enter your passwordadb devices in a terminal window with your phone plugged in.adb devices gives you a “no permissions” error, try typing the following in terminal
adb kill-serveradb start-server| Manufacturer | USB Vendor ID |
|---|---|
| Acer | 0502 |
| Dell | 413c |
| Foxconn | 0489 |
| Garmin-Asus | 091E |
| HTC (Older Phones) | 0bb4 |
| HTC (Newer phones) | 18d1 |
| Huawei | 12d1 |
| Kyocera | 0482 |
| LG | 1004 |
| Motorola | 22b8 |
| Nexus One/S | 18d1 |
| Nvidia | 0955 |
| Pantech | 10A9 |
| Samsung | 04e8 |
| Sharp | 04dd |
| Sony Ericsson | 0fce |
| ZTE | 19D2 |