Coder Social home page Coder Social logo

smsradar's Introduction

SMS Radar Build Status Maven Central Android Arsenal

Read incoming and outgoing text messages using an Android application across different Android SDK versions it's not trivial. If yo don't want to appear as SMS application and your application has to read incoming and outgoing SMSs this is your library.

This Android library offers you two main classes to use to start listening text messages. SMS Radar is implemented in top of an Android service. To start / stop listening text messages use SmsRadar.initializeSmsRadarService(context, listener) with a Context instance and a SmsListener implementation.

Each time the device owner receives one SMS the SmsListener used to initialize SmsRadarService service will be notified in on onSmsSent(Sms sms) or onSmsReceived(Sms sms) methods.

The SMS information provided on SmsListener methods is:

  • SMS address. MSISDN used to send/receive the SMS.
  • SMS date. SMS local creation date.
  • SMS content. Message sent in the SMS.
  • SMS type. One SMS can be received or sent. Review SmsType enum if need it.

This library works on Android 2.X or higher versions.

Download

Download the project, compile it using mvn clean install import smsradar-1.0.4.jar into your project.

Or declare it into your pom.xml

<dependency>
    <groupId>com.tuenti.smsradar</groupId>
    <artifactId>library</artifactId>
    <version>1.0.4</version>
</dependency>

Or into your build.gradle

dependencies{
    compile 'com.tuenti.smsradar:library:1.0.4'
}

Usage

Declare permissions to read SMS content provider in your AndroidManifest:

<uses-permission android:name="android.permission.READ_SMS"/>

Declare SmsRadar service in your AndroidManifest:

<service
		android:name=".SmsRadarService"
		android:exported="false"
		android:label="@string/app_name"/>

To use SMS Radar library you only have to initialize SmsRadar using a Context instance and one SmsListener:

SmsRadar.initializeSmsRadarService(context, new SmsListener() {
			@Override
			public void onSmsSent(Sms sms) {
				showSmsToast(sms);
			}

			@Override
			public void onSmsReceived(Sms sms) {
				showSmsToast(sms);
			}
		});

You can stop the SMS observer like in this sample:

SmsRadar.stopSmsRadarService(context);

Credits & Contact

SmsRadar was created by Android team at Tuenti Technologies S.L.. You can follow Tuenti engineering team on Twitter @tuentieng.

License

SmsRadar is available under the Apache License, Version 2.0. See LICENSE.txt file for more info.

smsradar's People

Contributors

jplana avatar magmax avatar oscarsj avatar pedrovgs avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

smsradar's Issues

Sms receive observer doesn't work on Android 5.0.1

Hello,

I just tried to use SmsRadar on a project. It works very well on Android 4.4.2 and below.

With device of my wife recently updated with Android 5.0.1, I tried SmsRadar on this Android version. Observe sent SMS works always well.

But, there is an issue to observe received SMS. It doesn't work in Android 5.0.1 .

Do you have experimented the same problem ?

Sylvain

Boolean parameter transfer problem

boolean notifyForDescendents = true;
contentResolver.registerContentObserver(smsUri, notifyForDescendents, smsObserver);
what is different to “contentResolver.registerContentObserver(smsUri, true, smsObserver);
”?and you have used many in your code...

Uri Permission Issue in Android Orio and above

I'm getting following error in android Orio and above devices. I think it is URI permission issue. Please take a look into it.

Fatal Exception: java.lang.SecurityException
Permission Denial: reading com.android.providers.telephony.SmsProvider uri content://sms/ from pid=9814, uid=10349 requires android.permission.READ_SMS, or grantUriPermission()

  android.os.Parcel.readException (Parcel.java:1942)
  android.content.ContentResolver.query (ContentResolver.java:670)
  com.tuenti.smsradar.SmsObserver.getSmsContentObserverCursor (SmsObserver.java:121)
  com.tuenti.smsradar.SmsObserver.onChange (SmsObserver.java:69)
  android.database.ContentObserver.onChange (ContentObserver.java:130)
  com.android.internal.os.ZygoteInit.main (ZygoteInit.java:767)

Does not work , please help

Gradle added dependency and also declared in manifest and initialized but cant get it to work , currently logging the sms instead of toasting
Added toast , it works

Default Message App prevents Listener from receiving SMS

Hi,

First of all, thanks for your work.

I was making some tests and found that if my phone uses Textra as the Default SMS application, the SMSRadar Listener will not pick up any of the messages.

If I change it to the Default SMS app on my phone, the SMS is received and parsed by the Listener.

Do you know why this might be happening?

Thanks! ✌️

Cannot resolve symbol 'SmsRadarService'

Hello, I have added the compile 'com.tuenti.smsradar:library:1.0.4' in the dependencies of my gradle and when I added the service tag inside my Android manifest I'm getting this warning "Cannot resolve symbol 'SmsRadarService'" How I can fix it? Thank you

background service

Hi,

how do I launch smsRadarService in a way that i keeps running indefinetly (until killed by a push on a button)?

Currently i launch a Bound Service that launches SmsRadar but the service gets stopped in a mysterious way but the OS.

Thank you for your help.

NullPointerException

Hello Guys

I got this crash from Fabric

Caused by java.lang.NullPointerException: Attempt to invoke virtual method 'void android.content.ContentResolver.unregisterContentObserver(android.database.ContentObserver)' on a null object reference at com.tuenti.smsradar.SmsRadarService.unregisterSmsContentObserver(SmsRadarService.java:126) at com.tuenti.smsradar.SmsRadarService.finishService(SmsRadarService.java:115) at com.tuenti.smsradar.SmsRadarService.onDestroy(SmsRadarService.java:71) at android.app.ActivityThread.handleStopService(ActivityThread.java:3504) at android.app.ActivityThread.-wrap26(Unknown Source) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1697) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:6501) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)

screen shot 2018-07-04 at 10 35 15 am

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.