0
I made a program to try to connect to a hosted database. However an error is occurring :
08-30 10:42:13.088 1710-1710/genus.qrcodefinal E/log_tag: Error in http Connection java.lang.Securityexception: Permission denied (Missing INTERNET permission?)
Part of the connection :
Button botaoconecta = (Button) findViewById(R.id.botaoconecta);
botaoconecta.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
try {
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost("linkdosite**");
HttpResponse response = httpclient.execute(httppost);
HttpEntity entity = response.getEntity();
InputStream is = entity.getContent();
} catch (Exception e) {
Log.e("log_tag", "Error in http connection " + e.toString());
}
}
});
Manifest :
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="genus.qrcodefinal">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
</application>
The app is to run on Android 6? Or better the targetVersion is API23 or higher?
– ramaral
On any Android 4.1.1 +
– JerryMoon
But the targetSdkVersion is API23 or higher?
– ramaral
If that’s what I’m thinking of in API 24, in my program, I’m kind of a beginner in the subject..
– JerryMoon
I reversed your edit so my answer wouldn’t be meaningless.
– ramaral