All Projects → mahdit83 → advancedSmsManager

mahdit83 / advancedSmsManager

Licence: Apache-2.0 license
Advanced SmsManager is avery handy library for sending sms for single and two sim-card phones with many options.

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to advancedSmsManager

React Native Phone Verification
The best React Native example for phone verification (an alternative to Twitter Digits).
Stars: ✭ 332 (+1129.63%)
Mutual labels:  sms, message
Wepush
专注批量推送的小而美的工具,目前支持:模板消息-公众号、模板消息-小程序、微信客服消息、微信企业号/企业微信消息、阿里云短信、阿里大于模板短信 、腾讯云短信、云片网短信、E-Mail、HTTP请求、钉钉、华为云短信、百度云短信、又拍云短信、七牛云短信
Stars: ✭ 2,597 (+9518.52%)
Mutual labels:  sms, message
Xa
Beautiful & Customizable logger ❤️
Stars: ✭ 78 (+188.89%)
Mutual labels:  simple, message
Nakedtensor
Bare bone examples of machine learning in TensorFlow
Stars: ✭ 2,443 (+8948.15%)
Mutual labels:  simple
Simplenetwork
simple TCP server / client C++ linux socket
Stars: ✭ 225 (+733.33%)
Mutual labels:  simple
ngx-ion-simple-mask
Input mask for Angular/Ionic
Stars: ✭ 21 (-22.22%)
Mutual labels:  simple
react-click-to-edit
Make any text editable.
Stars: ✭ 16 (-40.74%)
Mutual labels:  simple
Htmr
Simple and lightweight (< 2kB) HTML string to React element conversion library
Stars: ✭ 214 (+692.59%)
Mutual labels:  simple
Preservely
Lightweight Android lib preserving objects instances during orientation changes
Stars: ✭ 22 (-18.52%)
Mutual labels:  mvp
Vue Class Store
Universal Vue stores you write once and use anywhere
Stars: ✭ 243 (+800%)
Mutual labels:  simple
Blockchain Python
A blockchain implementation in Python
Stars: ✭ 233 (+762.96%)
Mutual labels:  simple
Sol2
Sol3 (sol2 v3.0) - a C++ <-> Lua API wrapper with advanced features and top notch performance - is here, and it's great! Documentation:
Stars: ✭ 2,791 (+10237.04%)
Mutual labels:  simple
android-mvp-kotlin
使用kotlin实现Android MVP模式,使用了Dagger2、Retrofit、RxJava等
Stars: ✭ 14 (-48.15%)
Mutual labels:  mvp
Simple Dash
A simple, fully responsive Dashboard to forward to the services of your choice!
Stars: ✭ 222 (+722.22%)
Mutual labels:  simple
hugoblog
Hugoblog is responsive, simple, and clean that would fit for your personal blog based on Hugo Theme Static Site Generator (SSG)
Stars: ✭ 48 (+77.78%)
Mutual labels:  simple
Alfred Simple
Simple theme for Alfred
Stars: ✭ 217 (+703.7%)
Mutual labels:  simple
MVPHelper
Base classes for quick and easy implementation of MVP for Android applications.
Stars: ✭ 17 (-37.04%)
Mutual labels:  mvp
Lazyblorg
Blogging with Org-mode for very lazy people
Stars: ✭ 226 (+737.04%)
Mutual labels:  simple
Riot
Simple and elegant component-based UI library
Stars: ✭ 14,596 (+53959.26%)
Mutual labels:  simple
Easythread
一款安全、轻巧、简单的线程池管理器
Stars: ✭ 250 (+825.93%)
Mutual labels:  simple

Download

advancedSmsManager

Advanced Sms Manager

AdvancedSmsManager is library for sending sms for single and two sim-card phones. it is very handy and usefull. It's two-sim mode works on Android.SDK > 21. For lower SDKs it send sms from default sim. For using in android studio add this to your dependency:

gradle

compile 'ir.mtajik.android:advancedsmsmanager:1.1.0'                    

Permissions

Before using SmsHandler you had to permit user with Manifest.permission.SEND_SMS and Manifest.permission.READ_PHONE_STATE .

Usage

After that simply call sendSms that have a Interface for all callbacks. smsId is a random unique auto generated Id that generated for every single sms that created by your app. In version 1.0.5 , i implement Builder design pattern. All the with parameters are optional.

SmsHandler.builder(context, "+989120000000")
                .withCarrierNameFilter("MCI")
                .withCustomDialogForSendSms(R.layout.my_sms_dialog)
                .withCustomDialogForChoseSim(R.layout.simcard_choosing_dialog)
                .needToShowSendSmsDialog(false)
                .build().sendSms(DIALOG_MESSAGE, SMS_BODY, new MySmsManager.SMSManagerCallBack() {
            @Override
            public void afterSuccessfulSMS(int smsId) {

            }

            @Override
            public void afterDelivered(int smsId) {

            }

            @Override
            public void afterUnSuccessfulSMS(int smsId, String message) {

            }

            @Override
            public void onCarrierNameNotMatch(int smsId, String message) {

            }
        });

If you do not want to ask user for send sms after premitted, put .needToShowSendSmsDialog(false) or else leave it and sms confirem dialog will be displayed.

Sim-card carrier name filter

You can set carrier name filter that works for SDK>22 with .withCarrierNameFilter("MCI") If user going to send sms from carrier that not match your filter ( in one or two sim card phones), the call-back :onCarrierNameNotMatch() will be call.

In new version there is a new feature that you can send Sms from specific carrier and do not show sim-card chosing dialog to user. Mention that sim chose dialog on two sim phones will always diplayed in pre 1.1.0 versions.

.needSendSmsFromSpecificCarrierWithOutAskingUser("MTN")

This will be check phone sim-cards carrier names in lower-case that contains "mtn". If one exists then sms will send from that carrier without asking from user. If there is no carrier name that matches this filter onCarrierNameNotMatch() will be call. When you use this option no need for using .withCarrierNameFilter() option. But if you use both of them the last used properties will override carrierNameFilter.

Custom Parameters

You can pass custom Layoutparameters for sendSmsDialog

WindowManager.LayoutParams layoutParams = new WindowManager.LayoutParams();
layoutParams.width = WindowManager.LayoutParams.MATCH_PARENT;
layoutParams.height = WindowManager.LayoutParams.WRAP_CONTENT;
layoutParams.flags = WindowManager.LayoutParams.FLAG_DIM_BEHIND;
layoutParams.dimAmount = 0.6f;

And add with .withLayoutParams(layoutParams)

You can also pass widht or height in dp for sendSmsDialog and they will ovveride LayoutParams.

.withHeight(200) // 200dp
.withHeight(800) // 800dp

Custom Layouts

You can inflate you custom view for both sendSmsDialog and simChoseDialog if they are going to shown. Mention that they must have these component and ids. ( Extended components from these components are acceptable)

for sendSmsDialog:

<Button
	android:id="@+id/send_button"
	...
           />
            
<Button
	android:id="@+id/cancel_button"
	...
           />

<TextView
        android:id="@+id/dialog_title"
        ...
          />

<ProgressBar
        android:id="@+id/progressBar_total"
	...
	   />

and for simChoseDialog :

<Button
	android:id="@+id/sim1_button"
	...
           />
            
<Button
	android:id="@+id/sim2_button"
	...
           />

<TextView
        android:id="@+id/dialog_title"
        ...
          />

Dependencies

This library created with MVP architecture and Uses Dagger2 as DI container with these dependencies:

compile 'com.google.dagger:dagger:2.7'
annotationProcessor 'com.google.dagger:dagger-compiler:2.7'

So if you use dagger2 make sure that use compatible dependencies. I hope this library would be useful and wait for your comments.

Mahdi Tajik

This is my weblog: http://www.mahditajik.ir

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].