Skip to content

Commit

Permalink
update README
Browse files Browse the repository at this point in the history
  • Loading branch information
ibnux committed Aug 31, 2021
2 parents 57e591d + 2a253e3 commit 85e86b1
Show file tree
Hide file tree
Showing 7 changed files with 79 additions and 26 deletions.
35 changes: 35 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,47 @@
This is recreate from [Old SMS Gateway](https://github.com/anjlab/android-sms-gateway)
now using Firebase
to turn my android as sms sender

# HOW IT WORKS

Sending SMS

1. You send data to sms.ibnux.net (or your server)
2. Server will send push notification
3. App receive push notification, and route it to sms
4. App receive sent notification, and post it to your server
5. App receive delivered notification, and post it to your server

RECEIVE SMS
1. App receive SMS
2. App send it to your server

# HOW TO USE?

Download APK from [release](https://github.com/ibnux/Android-SMS-Gateway/releases) page
then open https://sms.ibnux.net/ to learn how to send sms

you can find backend folder for server side in this source

to compile yourself, you need your own Firebase

# FEATURES

- SENDING SMS
- RECEIVE SMS to SERVER
- SENT NOTIFICATION to SERVER
- DELIVERED NOTIFICATION to SERVER

## Traktir @ibnux

[<img src="https://ibnux.github.io/KaryaKarsa-button/karyaKarsaButton.png" width="128">](https://karyakarsa.com/ibnux)

[<img src="https://ibnux.github.io/Trakteer-button/trakteer_button.png" width="120">](https://trakteer.id/ibnux)

## DONATE @ibnux

[paypal.me/ibnux](https://paypal.me/ibnux)

# LICENSE
## Apache License 2.0

Expand Down
6 changes: 2 additions & 4 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ android {
applicationId "com.ibnux.smsgateway"
minSdkVersion 16
targetSdkVersion 29
versionCode 2
versionName "1.2"
versionCode 3
versionName "2.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
Expand All @@ -32,10 +32,8 @@ android {
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.firebase:firebase-messaging:19.0.1'
implementation 'com.karumi:dexter:6.1.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
Expand Down
28 changes: 24 additions & 4 deletions app/src/main/java/com/ibnux/smsgateway/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,8 @@
import android.os.Bundle;
import android.os.Handler;
import android.text.InputType;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.*;
import android.view.inputmethod.EditorInfo;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
Expand Down Expand Up @@ -43,13 +41,15 @@ public class MainActivity extends AppCompatActivity {
RecyclerView recyclerview;
LogAdapter adapter;
SwipeRefreshLayout swipe;
EditText editTextSearch;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

recyclerview = findViewById(R.id.recyclerview);
editTextSearch = findViewById(R.id.editTextSearch);
swipe = findViewById(R.id.swipe);
info = findViewById(R.id.text);
info.setText("Click Me to Show Configuration");
Expand Down Expand Up @@ -99,6 +99,26 @@ public void run() {
});
}
});


editTextSearch.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
boolean handled = false;
if (actionId == EditorInfo.IME_ACTION_SEARCH) {
recyclerview.post(new Runnable() {
@Override
public void run() {
adapter.search(editTextSearch.getText().toString());
editTextSearch.clearFocus();
}
});
handled = true;
}
return handled;
}
});

}

public void updateInfo(){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public abstract class PaginationListener extends RecyclerView.OnScrollListener {
/**
* Set scrolling threshold here (for now i'm assuming 10 item in one page)
*/
private static final int PAGE_SIZE = 5;
private static final int PAGE_SIZE = 50;
/**
* Supporting only LinearLayoutManager for now.
*/
Expand Down
23 changes: 11 additions & 12 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
Expand All @@ -25,19 +24,19 @@
android:gravity="center_horizontal"
android:linksClickable="true"
android:text="Hello World!"
android:textIsSelectable="true"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
android:textIsSelectable="true"/>

<LinearLayout
<EditText
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#000000"
android:orientation="horizontal">

</LinearLayout>
android:layout_height="wrap_content"
android:inputType="textPersonName"
android:ems="10"
android:id="@+id/editTextSearch"
android:hint="@android:string/search_go"
android:autofillHints=""
android:textSize="12sp"
android:imeOptions="actionSearch"
android:selectAllOnFocus="true"/>

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerview"
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="colorAccent">@color/colorPrimary</item>
</style>

</resources>
9 changes: 5 additions & 4 deletions backend/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,14 @@
die();
}

$hasil = sendPush($token,$secret,$time,$to, $text);
$result = sendPush($token,$secret,$time,$to, $text);

if(isset($_GET['debug']) && count($_REQUEST)>1)
file_put_contents("log.txt",$hasil."\n\n",FILE_APPEND);
echo $hasil;
file_put_contents("log.txt",$result."\n\n",FILE_APPEND);
echo $result;

function sendPush($token,$secret,$time,$to, $message) {
global $firebasekey;
$url = 'https://fcm.googleapis.com/fcm/send';

$fields = array (
Expand Down Expand Up @@ -74,4 +75,4 @@ function sendPush($token,$secret,$time,$to, $message) {
curl_close ( $ch );

return $result;
}
}

0 comments on commit 85e86b1

Please sign in to comment.