http - Android: HTTPClient -
i trying http-cleint tutorials svn.apache.org. while running application getting following error in console.
[2010-04-30 09:26:36 - halloandroid] activitymanager: java.lang.securityexception: permission denial: starting intent { act=android.intent.action.main cat=[android.intent.category.launcher] flg=0x10000000 cmp=com.org.example/.halloandroid } null (pid=-1, uid=-1) requires android.permission.internet
i have added android.permission.internet in androidmanifest.xml.
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.org.example" android:versioncode="1" android:versionname="1.0"> <application android:icon="@drawable/icon" android:label="@string/app_name"> <activity android:name=".halloandroid" android:label="@string/app_name" android:permission="android.permission.internet"> <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> </intent-filter> </activity> </application> <uses-permission android:name="android.permission.internet"></uses-permission> </manifest>
the java code in halloandroid.java follows
httpclient httpclient = new defaulthttpclient(); httpget httpget2 = new httpget("http://google.com/"); httpresponse response2 = null; try { response2 = httpclient.execute(httpget2); } catch (clientprotocolexception e1) { // todo auto-generated catch block e1.printstacktrace(); } catch (ioexception e1) { // todo auto-generated catch block e1.printstacktrace(); } httpentity entity = response2.getentity(); if (entity != null) { long len = entity.getcontentlength(); if (len != -1 && len < 2048) { try { log.d(tag, entityutils.tostring(entity)); } catch (parseexception e) { // todo auto-generated catch block e.printstacktrace(); } catch (ioexception e) { // todo auto-generated catch block e.printstacktrace(); } } else { // stream content out }
any appreciated.
problem solved. line in androidmanifest.xml file causing trouble.
android:permission="android.permission.internet"
Comments
Post a Comment