OkHttpClient client = new OkHttpClient.Builder().addInterceptor(new Interceptor() {
@Override
public Response intercept(Chain chain) throws IOException {
Request newRequest = chain.request().newBuilder()
.addHeader("Authorization", "Bearer " + token)
.build();
return chain.proceed(newRequest);
}
}).build();
Retrofit retrofit = new Retrofit.Builder()
.client(client)
.baseUrl(/** your url **/)
.addConverterFactory(GsonConverterFactory.create())
.build();
6 Mayıs 2017 Cumartesi
token Header
sms atma telefon açma web site açma
https://www.mobilhanem.com/android-uygulamadan-telefon-acma-sms-atma-mail-atma-web-sitesini-tarayicida-acma/
5 Mayıs 2017 Cuma
c# web servis Prosedür hızlandırma ## Kod kalabalığını azaltma
https://paste.ubuntu.com/24515932/
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
namespace Argede_WebService.Sql_Prosodur_Otomatik
{
public class Sql_Prosodur_DirektBaglanti
{
private List<Model> arrayliststatic = new List<Model>();
public class Model
{
public string Prosedur_Adi { get; set; }
public SqlDbType Prosedur_Tipi { get; set; }
public string Prosedur_YuklencekVeri { get; set; }
public string Prosedur_Nvarcharsa_Uzunluk { get; set; }
}
public bool Pro_Calistir(string prosedur_Adi)
{
SqlConnection myConnection = new SqlConnection("Data Source=" + staticdegerler.DataSource + ";Initial Catalog=" + staticdegerler.Catalog + ";Integrated Security=True");
bool response = true;
try
{
SqlCommand sqlCmd = new SqlCommand();
sqlCmd.Connection = myConnection;
myConnection.Open();
sqlCmd.CommandType = System.Data.CommandType.StoredProcedure;
sqlCmd.CommandText = prosedur_Adi;
foreach (Model eleman in arrayliststatic)
{
if (eleman.Prosedur_Tipi.Equals(SqlDbType.NVarChar))
{
sqlCmd.Parameters.Add(eleman.Prosedur_Adi, eleman.Prosedur_Tipi,Convert.ToInt32(eleman.Prosedur_Nvarcharsa_Uzunluk));
}
else
{
sqlCmd.Parameters.Add(eleman.Prosedur_Adi, eleman.Prosedur_Tipi);
}
sqlCmd.Parameters[eleman.Prosedur_Adi].Value = eleman.Prosedur_YuklencekVeri;
}
sqlCmd.ExecuteNonQuery();
myConnection.Close();
}
catch (Exception ex)
{
response = false;
}
return response;
}
public void ProsedurEkle(string Prosedur_Adi, SqlDbType tip, string veri, string charuzuluk)
{ // sqldatatype ayrı al
Model model = new Model();
model.Prosedur_Adi = Prosedur_Adi;
model.Prosedur_Tipi = tip;
model.Prosedur_YuklencekVeri = veri;
model.Prosedur_Nvarcharsa_Uzunluk = charuzuluk;
arrayliststatic.Add(model);
}
}
}
--------------------------
namespace Argede_WebService.Sql_Prosodur_Otomatik
{
public class staticdegerler
{
public static string DataSource = "AHMET";
public static string Catalog = "Argede_Next_Database";
}
}
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
namespace Argede_WebService.Sql_Prosodur_Otomatik
{
public class Sql_Prosodur_DirektBaglanti
{
private List<Model> arrayliststatic = new List<Model>();
public class Model
{
public string Prosedur_Adi { get; set; }
public SqlDbType Prosedur_Tipi { get; set; }
public string Prosedur_YuklencekVeri { get; set; }
public string Prosedur_Nvarcharsa_Uzunluk { get; set; }
}
public bool Pro_Calistir(string prosedur_Adi)
{
SqlConnection myConnection = new SqlConnection("Data Source=" + staticdegerler.DataSource + ";Initial Catalog=" + staticdegerler.Catalog + ";Integrated Security=True");
bool response = true;
try
{
SqlCommand sqlCmd = new SqlCommand();
sqlCmd.Connection = myConnection;
myConnection.Open();
sqlCmd.CommandType = System.Data.CommandType.StoredProcedure;
sqlCmd.CommandText = prosedur_Adi;
foreach (Model eleman in arrayliststatic)
{
if (eleman.Prosedur_Tipi.Equals(SqlDbType.NVarChar))
{
sqlCmd.Parameters.Add(eleman.Prosedur_Adi, eleman.Prosedur_Tipi,Convert.ToInt32(eleman.Prosedur_Nvarcharsa_Uzunluk));
}
else
{
sqlCmd.Parameters.Add(eleman.Prosedur_Adi, eleman.Prosedur_Tipi);
}
sqlCmd.Parameters[eleman.Prosedur_Adi].Value = eleman.Prosedur_YuklencekVeri;
}
sqlCmd.ExecuteNonQuery();
myConnection.Close();
}
catch (Exception ex)
{
response = false;
}
return response;
}
public void ProsedurEkle(string Prosedur_Adi, SqlDbType tip, string veri, string charuzuluk)
{ // sqldatatype ayrı al
Model model = new Model();
model.Prosedur_Adi = Prosedur_Adi;
model.Prosedur_Tipi = tip;
model.Prosedur_YuklencekVeri = veri;
model.Prosedur_Nvarcharsa_Uzunluk = charuzuluk;
arrayliststatic.Add(model);
}
}
}
--------------------------
namespace Argede_WebService.Sql_Prosodur_Otomatik
{
public class staticdegerler
{
public static string DataSource = "AHMET";
public static string Catalog = "Argede_Next_Database";
}
}
4 Mayıs 2017 Perşembe
android network provider ##iyileştirilmiş sonuç almak için
https://paste.ubuntu.com/24513203/
---------------------
Wifiac();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
requestPermissions(new String[]{Manifest.permission.ACCESS_COARSE_LOCATION}, 1);
Log.e("asdasdas", "chek ilk if");
} else {
NetworkProvider();
Log.e("CurrenCalisti", "gpsCofig");
}
@Overridepublic void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
switch (requestCode) {
case 1:
// If request is cancelled, the result arrays are empty. if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
NetworkProvider();
} else {
// permission denied
}
break;
}
}
---------------
private void NetworkProvider(){
locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
return;
}
locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 100, 0, new LocationListener() {
@Override public void onLocationChanged(Location location) {
String currentLat = String.valueOf(location.getLatitude());
String currentLot = String.valueOf(location.getLongitude());
TabbedActivity._curLat =location.getLatitude();
TabbedActivity._curLng =location.getLongitude();
Log.e("Curren= ", currentLat + "," + currentLot);
}
@Override public void onStatusChanged(String s, int i, Bundle bundle) {
}
@Override public void onProviderEnabled(String s) {
}
@Override public void onProviderDisabled(String s) {
}
});
}
---------------
public void Wifiac(){
WifiManager wifiManager = (WifiManager)getSystemService(Context.WIFI_SERVICE);
boolean enabled = wifiManager.setWifiEnabled(true);
Log.e("wifiDurum", String.valueOf(enabled));
}
-----------------
C# WEB SERVİS CLAS İÇİNDE LİST TANIMLAMA #JSON
public class BayiListe
{
public Boolean Durum { get; set; }
public string BayiAdi { get; set; }
}
//////////////// MODEL
public class Kullanici_Profili
{
public string KullaniciAdi { get; set; }
public string Bölge { get; set; }
public string TelNo { get; set; }
public string Resim { get; set; }
public List<BayiListe> BayiListe = new List<BayiListe>();
}
////////////////MODEL
SqlDataReader reader = null;
SqlCommand sqlCmd = new SqlCommand();
sqlCmd.CommandType = System.Data.CommandType.StoredProcedure;
sqlCmd.CommandText = "sp_BayiListesi";
sqlCmd.Parameters.Add("@UserID", SqlDbType.Int);
sqlCmd.Parameters["@UserID"].Value = UserId;
sqlCmd.Connection = myConnection;
myConnection.Open();
reader = sqlCmd.ExecuteReader();
Kullanici_Profili model = new Kullanici_Profili();
while (reader.Read())
{
BayiListe model2 = new BayiListe();
model2.Durum = Convert.ToBoolean(reader.GetValue(0));
model2.BayiAdi = reader.GetValue(1).ToString();
model.BayiListe.Add(model2);
}
myConnection.Close();
////////////////////////
SqlDataReader reader2 = null;
SqlCommand sqlCmd2 = new SqlCommand();
sqlCmd2.CommandType = System.Data.CommandType.StoredProcedure;
sqlCmd2.CommandText = "sp_Kullanici_Profili";
sqlCmd2.Parameters.Add("@Userid", SqlDbType.Int);
sqlCmd2.Parameters["@Userid"].Value = UserId;
sqlCmd2.Connection = myConnection;
myConnection.Open();
reader2 = sqlCmd2.ExecuteReader();
while (reader2.Read())
{
model.KullaniciAdi = reader2.GetValue(0).ToString();
model.Bölge = reader2.GetValue(1).ToString();
model.TelNo = reader2.GetValue(2).ToString();
model.Resim = reader2.GetValue(3).ToString();
break;
}
myConnection.Close();
return model;
{
public Boolean Durum { get; set; }
public string BayiAdi { get; set; }
}
//////////////// MODEL
public class Kullanici_Profili
{
public string KullaniciAdi { get; set; }
public string Bölge { get; set; }
public string TelNo { get; set; }
public string Resim { get; set; }
public List<BayiListe> BayiListe = new List<BayiListe>();
}
////////////////MODEL
SqlDataReader reader = null;
SqlCommand sqlCmd = new SqlCommand();
sqlCmd.CommandType = System.Data.CommandType.StoredProcedure;
sqlCmd.CommandText = "sp_BayiListesi";
sqlCmd.Parameters.Add("@UserID", SqlDbType.Int);
sqlCmd.Parameters["@UserID"].Value = UserId;
sqlCmd.Connection = myConnection;
myConnection.Open();
reader = sqlCmd.ExecuteReader();
Kullanici_Profili model = new Kullanici_Profili();
while (reader.Read())
{
BayiListe model2 = new BayiListe();
model2.Durum = Convert.ToBoolean(reader.GetValue(0));
model2.BayiAdi = reader.GetValue(1).ToString();
model.BayiListe.Add(model2);
}
myConnection.Close();
////////////////////////
SqlDataReader reader2 = null;
SqlCommand sqlCmd2 = new SqlCommand();
sqlCmd2.CommandType = System.Data.CommandType.StoredProcedure;
sqlCmd2.CommandText = "sp_Kullanici_Profili";
sqlCmd2.Parameters.Add("@Userid", SqlDbType.Int);
sqlCmd2.Parameters["@Userid"].Value = UserId;
sqlCmd2.Connection = myConnection;
myConnection.Open();
reader2 = sqlCmd2.ExecuteReader();
while (reader2.Read())
{
model.KullaniciAdi = reader2.GetValue(0).ToString();
model.Bölge = reader2.GetValue(1).ToString();
model.TelNo = reader2.GetValue(2).ToString();
model.Resim = reader2.GetValue(3).ToString();
break;
}
myConnection.Close();
return model;
## Android Socket istemci -- LocalHost sunucu haberleşme ##Socket io ##ağ programlam odev 2
SOCKET KULLARAK ANDROİD İLE SUNUCU HABERLEŞMESİ
NOT : JAVA SQL BAGLANMAK İÇİN SQLJDBC BİLGİSAYARA KURUP PROJE İÇİNE EXTRADAN ENTEGRE EDİLMESİ LAZIM
PROJE İÇERİĞİ KODLAR
https://yadi.sk/d/RMynh4nl3HgHor
## BİTİRME PROJESİ SON AŞAMA ## SAÜ BİLGİSAYAR MÜHENDİSLİĞİ
RAPOR
Githup : Android
https://github.com/yenenahmet/bitirme/tree/master/ErasmusApp/app/src/main/java/com/example/ahmet/erasmusapp
Githup : Servis
https://github.com/yenenahmet/bitirme_servis/tree/master/Bitirme_Ekonomistler
https://github.com/yenenahmet/bitirme/tree/master/ErasmusApp/app/src/main/java/com/example/ahmet/erasmusapp
Githup : Servis
https://github.com/yenenahmet/bitirme_servis/tree/master/Bitirme_Ekonomistler
--------------------------------------------------------------------------------------------------------------------------
Kaydol:
Kayıtlar (Atom)