You are on page 1of 15

Project Report

on
S – Assistant App
Submitted in the partial fulfillment of the requirement for the award of Degree of
Bachelor of Technology
in
COMPUTER SCIENCE & ENGINEERING
Batch
(2017-2021)

Submitted To: - Submitted by:


HOD(CSE) Prabhnoor Singh - 1701327
ER.Vinod Sharma Sanyam Dhawan - 1701359
ER.Tejinder Sharma Shivam Kapoor - 1701368
Simranjit Kaur - 1701377

DEARTMENT OF COMPUTER SCIENCE & ENGINEERING

Amritsar College of engineering & Technology,


Amritsar
(Autonomous college under UGC Act-1956[2(f)and 12(B)])
ACKNOWLEDGEMENT

This is a humble effort to express our sincere gratitude towards those who have guided and helped me to complete
this project.
A project is major milestone during the study period of a student. As such this project was a challenge to me and
was an opportunity to prove my caliber. I am highly grateful and obliged to each and every one making me help
out of problems being faced by us.
It would not have been possible to see through the undertaken project without the guidance of Er.Tejinde
Sharmar. It was purely on the basis of their experience and knowledge that we able to clear all the theoretical and
technical hurdles during the development phases of this project work.
Last but not the least I am very thankful to our Head of Department Er. Vinod Sharma and all Members of
Computer Science Deptt. who gave us an opportunity to face real time problems while fulfilling need of an
organization by making projects for them.
DECLARATION
We Sanyam Dhawan, Shivam Kapoor, Prabhnoor Singh and Simranjit Kaur hereby declare that the project
work entitled “Notification listener" is an authentic record of my own work carried out as requirements of
Institutional Training project for the award of degree of B. Tech (CSE), Amritsar Group of College,
Amritsar under the guidance of Er.Tejinder Sharma.

Certified that the above statement made by the student is correct to the best of our knowledge and
Brief.

(Signature of students)
Sanyam Dhawan – 1701359
Prabhnoor Singh – 1701327
Shivam Kapoor – 1701368
Simranjit Kaur - 1701377

Faculty coordinator
Er.Tejinder Sharma (Assistant professor-CSE Department)
INDEX PAGE

Sr. No. TITLE Page No.

1. Introduction about the subject

2. Introduction to the project

3. Source Code

4.
Output
Android Studio
Android Studio is the official integrated development environment (IDE)
for Google's Android operating system, built on JetBrains' IntelliJ IDEA software and designed
specifically for Android development. It is available for download
on Windows, macOS and Linux based operating systems or as a subscription-based service in
2020. It is a replacement for the Eclipse Android Development Tools (ADT) as the primary IDE
for native Android application development.
The following features are provided in the current stable version:[15][16]

▪ Gradle-based build support


▪ Android-specific refactoring and quick fixes
▪ Lint tools to catch performance, usability, version compatibility and other problems
▪ ProGuard integration and app-signing capabilities
▪ Template-based wizards to create common Android designs and components
▪ A rich layout editor that allows users to drag-and-drop UI components, option to preview
layouts on multiple screen configurations[17]
▪ Support for building Android Wear apps
▪ Built-in support for Google Cloud Platform, enabling integration with Firebase Cloud
Messaging (Earlier ‘Google Cloud Messaging’) and Google App Engine[18]
▪ Android Virtual Device (Emulator) to run and debug apps in the Android studio.
Java

Java is a general-purpose programming language that is class-based, object-oriented,


and designed to have as few implementation dependencies as possible. It is intended to
let application developers write once, run anywhere (WORA), meaning
that compiled Java code can run on all platforms that support Java without the need for
recompilation. Java applications are typically compiled to bytecode that can run on
any Java virtual machine (JVM) regardless of the underlying computer architecture.
The syntax of Java is similar to C and C++, but it has fewer low-level facilities than either
of them. As of 2019, Java was one of the most popular programming languages in
use according to GitHub,[19][20] particularly for client-server web applications, with a
reported 9 million developers.

It is used for:

▪ Mobile applications (specially Android apps)


▪ Desktop applications
▪ Web applications
▪ Web servers and application servers
▪ Games
▪ Database connection
▪ And much, much more!
Notification Listener

Our Apk will let you to put someone on alert . By alert I mean when ever that person message you on apk
like Hangout your device will vibrate until you remove the notification generated on your Notification
bar. So that you will not miss your boss message. You may think why we created this app how is this
useful then think of a scenario that your boss said “Mr.xyz I will share important document in some time”
So what will you do to get informed when he sent it or how will you distinguish between another
notification and this notification ? Then our app will let you do any another work you want to do.
Activity_main.xml

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" android:orientation="1" android:layout_width="-
1" android:layout_height="-1">

<ScrollView android:layout_width="-1" android:layout_height="-1">

<TableLayout android:id="false" android:layout_width="-1" android:layout_height="-2" />

</ScrollView>

</LinearLayout>
Main activity.java
import android.app.Activity;

import android.content.BroadcastReceiver;

import android.content.Context;

import android.content.Intent;

import android.content.IntentFilter;

import android.graphics.Color;

import android.os.Bundle;

import android.view.Menu;
import android.text.html;

import android.widget.TableLayout;

import android.widget.TableRow;

import android.widget.TableRow.LayoutParams;

import android.widget.TextView;

import androidx.localbroadcastmanager.content.LocalBroadcastManager;

public class MainActivity extends Activity {

private BroadcastReceiver onNotice = new BroadcastReceiver() {

public void onReceive(Context context, Intent intent) {

String pack = intent.getStringExtra("package");

String title = intent.getStringExtra("title");

String text = intent.getStringExtra("text");

TableRow tr = new TableRow(MainActivity.this.getApplicationContext());

tr.setLayoutParams(new LayoutParams(-1, -2));

TextView textview = new TextView(MainActivity.this.getApplicationContext());

textview.setLayoutParams(new LayoutParams(-2, -2, 1.0f));

textview.setTextSize(20.0f);

textview.setTextColor(Color.parseColor("#0B0719"));

StringBuilder stringBuilder = new StringBuilder();


stringBuilder.append(pack);

stringBuilder.append("<br><b>");

stringBuilder.append(title);

stringBuilder.append(" : </b>");

stringBuilder.append(text);

textview.setText(Html.fromHtml(stringBuilder.toString()));

tr.addView(textview);

MainActivity.this.tab.addView(tr);

};

TableLayout tab;

/* Access modifiers changed, original: protected */

public void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.activity_main);

this.tab = (TableLayout) findViewById(R.id.tab);

LocalBroadcastManager.getInstance(this).registerReceiver(this.onNotice, new
IntentFilter("Msg"));

public boolean onCreateOptionsMenu(Menu menu) {

getMenuInflater().inflate(R.menu.menu, menu);

return true;

}
Notification Service.java

Import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.Vibrator;
import android.service.notification.NotificationListenerService;
import android.service.notification.StatusBarNotification;
import android.util.Log;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;

public class NotificationService extends NotificationListenerService {


Context context;
public Vibrator v;

public void onCreate() {


super.onCreate();
this.context = getApplicationContext();
}

public void onNotificationPosted(StatusBarNotification sbn) {


String pack = sbn.getPackageName();
String ticker = sbn.getNotification().tickerText.toString();
Bundle extras = sbn.getNotification().extras;
String name = “Balgobind”;
String title = extras.getString(“android.title”);
String text = extras.getCharSequence(“android.text”).toString();
if (title.contains(name) || text.contains(name)) {
((Vibrator) getSystemService(“vibrator”)).vibrate(new long[]{0, 100, 1000}, 0);
}
Log.i(“Package”, pack);
Log.i(“Ticker”, ticker);
Log.i(“Title”, title);
Log.i(“Text”, text);
Intent msgrcv = new Intent(“Msg”);
msgrcv.putExtra(“package”, pack);
msgrcv.putExtra(“ticker”, ticker);
msgrcv.putExtra(“title”, title);
msgrcv.putExtra(“text”, text);
LocalBroadcastManager.getInstance(this.context).sendBroadcast(msgrcv);
}

public void onNotificationRemoved(StatusBarNotification sbn) {


Log.i(“Msg”, “Notification Removed”);
this.v.cancel();
}
}
Manifest.xml
<?xml version=”1.0” encoding=”utf-8”?>
<manifest xmlns:android=http://schemas.android.com/apk/res/android
Package=”com.github.chagall.notificationlistenerexample”>

<application
Android:allowBackup=”true”
Android:icon=”@mipmap/ic_launcher”
Android:label=”@string/app_name”
Android:supportsRtl=”true”
Android:theme=”@style/AppTheme”>
<activity android:name=”.MainActivity”>
<intent-filter>
<action android:name=”android.intent.action.MAIN” />

<category android:name=”android.intent.category.LAUNCHER” />


</intent-filter>
</activity>

<service android:name=”.NotificationListenerExampleService”
Android:label=”@string/service_label”

Android:permission=”android.permission.BIND_NOTIFICATION_LISTENER_SERVIC
E”>
<intent-filter>
<action android:name=”android.service.notification.NotificationListenerService”
/>
</intent-filter>
</service>
</application>

</manifest>
Screenshot
Fig 1: Device on which Notification will come and waiting for Notification
Fig2: The sender sends the message to receiver
Fig 3: On Notification received.

You might also like