Skip to content

Commit c3e6033

Browse files
committed
server url added
1 parent a4c81ad commit c3e6033

6 files changed

Lines changed: 33 additions & 12 deletions

File tree

0 Bytes
Binary file not shown.

app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@ dependencies {
2727
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
2828
//networking volley library
2929
implementation 'com.android.volley:volley:1.1.0'
30-
implementation 'com.github.mobtexting:mobtexting-android-sdk:5f792a64b9'
30+
implementation 'com.github.mobtexting:mobtexting-android-sdk:a4c81ad31a'
3131
implementation 'com.msg91.sendotp.library:library:3.1'
3232
}

app/src/main/AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
33
package="com.mobtexting.sms">
4-
4+
<uses-permission android:name="android.permission.INTERNET"/>
55
<application
66
android:allowBackup="true"
77
android:icon="@mipmap/ic_launcher"

app/src/main/java/com/mobtexting/sms/MainActivity.java

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,36 @@
33
import android.support.v7.app.AppCompatActivity;
44
import android.os.Bundle;
55
import android.util.Log;
6+
import android.widget.Toast;
67

7-
import com.mobtexting.Config;
8+
import com.mobtexting.Communicator;
9+
import com.mobtexting.event.ErrorEvent;
10+
import com.mobtexting.event.ServerEvent;
11+
import com.squareup.otto.Subscribe;
812

9-
public class MainActivity extends AppCompatActivity {
1013

14+
public class MainActivity extends AppCompatActivity {
15+
private Communicator communicator;
1116
@Override
1217
protected void onCreate(Bundle savedInstanceState) {
1318
super.onCreate(savedInstanceState);
1419
setContentView(R.layout.activity_main);
15-
String dd=Config.printText("dsadas");
16-
Log.d("message",dd);
20+
21+
communicator=new Communicator();
22+
communicator.loginPost("test","123");
23+
}
24+
25+
@Subscribe
26+
public void onServerEvent(ServerEvent serverEvent){
27+
Toast.makeText(this, ""+serverEvent.getServerResponse().getMessage(), Toast.LENGTH_SHORT).show();
28+
if(serverEvent.getServerResponse().getUsername() != null){
29+
Toast.makeText(getBaseContext(),serverEvent.getServerResponse().getUsername(),Toast.LENGTH_SHORT).show();
30+
}
31+
Toast.makeText(getBaseContext(),serverEvent.getServerResponse().getMessage(),Toast.LENGTH_SHORT).show();
32+
}
33+
34+
@Subscribe
35+
public void onErrorEvent(ErrorEvent errorEvent){
36+
Toast.makeText(this,""+errorEvent.getErrorMsg(),Toast.LENGTH_SHORT).show();
1737
}
1838
}

mobtextingsms/src/main/java/com/mobtexting/Communicator.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616

1717
public class Communicator {
1818
private static final String TAG = "Communicator";
19-
private static final String SERVER_URL = "http://www.sample.al";
19+
private static final String SERVER_URL = "http://api.mobtexting.com/v1/sms";
2020

21-
public void loginPost(String username, String password){
21+
public void loginPost(String apikey, String message,String mobile_no,String senderId){
2222

2323
HttpLoggingInterceptor logging = new HttpLoggingInterceptor();
2424
logging.setLevel(HttpLoggingInterceptor.Level.BODY);
@@ -33,7 +33,7 @@ public void loginPost(String username, String password){
3333

3434
Interface service = retrofit.create(Interface.class);
3535

36-
Call<ServerResponse> call = service.post("login",username,password);
36+
Call<ServerResponse> call = service.post(apikey,message,mobile_no,senderId);
3737

3838
call.enqueue(new Callback<ServerResponse>() {
3939
@Override

mobtextingsms/src/main/java/com/mobtexting/Interface.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@ public interface Interface {
1212
@FormUrlEncoded
1313
@POST("/sp/index.php")
1414
Call<ServerResponse> post(
15-
@Field("method") String method,
16-
@Field("username") String username,
17-
@Field("password") String password
15+
@Field("api_key") String method,
16+
@Field("message") String username,
17+
@Field("mobile_no") String password,
18+
@Field("sender_id") String sender_id
1819
);
1920

2021
@GET("/sp/index.php")

0 commit comments

Comments
 (0)