| I later figured it out and came to know that a BroadcastReceiver will be the right thing to use in this case. BroadcastReceiver is a specially designed component offered by Android OS, and it is used to handle various broadcasts sent by apps or OS components. The broadcasts related to telephone call states are sent by TelephonyManager which is a component of Android OS. The phone state receiver given below can be used in scenarios like call blocking, call tracking, and sending information to http or cloud based servers. This salient features of my phone state receiver are given below
|
Monday, June 2, 2014
How to create PhoneStateReceiver get CLI and call events
During first 5 years of my career I luckily worked at software houses that created computer telephony related software, I had used Microsoft TAPI and Dialogic APIs to create IVR and Operator Console and Call Recorder software. When I first started Android programming in 2010, I was very curious about phone states and CLI.
Wednesday, May 21, 2014
Incoming SMS Receivers Stop Work Google Hangouts Is Villain
I'm working on an app which notifies a Windows desktop/laptop when a new SMS text message arrives on an Android phone, this app does not do anything else to the text of incoming SMS. It only reads and notifies the laptop using Bluetooth(or WiFi).
My app stopped working all of a sudden, and I didn't know what was wrong. There's a nice blog entry on making your app compatible with Android 4 KitKat, I read it thoroughly but in the end I discovered my will not be affected since it's too benign and only the apps that might cause trouble for other apps.
My sixth sense raised an alarm shortly afterwards, that perhaps this issue is being caused by Google Hangouts. I had allowed Google Hangouts to take care of my SMS messages a few hours ago, without knowing it will screw my poor app.
I got Android 4.3.3 running on Sony Xperia Z smart phone.
Given below are screen shots from Hangouts app settings.
On a side note, I did think once that maybe this error is caused an up version of Android because my app was working well on my older QMobile A50 which sports Android Jelly Bean 4.1.3.
In case you're wondering what permissions are needed to make a new SMS broadcast receiver work, well I got the following:
My app stopped working all of a sudden, and I didn't know what was wrong. There's a nice blog entry on making your app compatible with Android 4 KitKat, I read it thoroughly but in the end I discovered my will not be affected since it's too benign and only the apps that might cause trouble for other apps.
My sixth sense raised an alarm shortly afterwards, that perhaps this issue is being caused by Google Hangouts. I had allowed Google Hangouts to take care of my SMS messages a few hours ago, without knowing it will screw my poor app.
I got Android 4.3.3 running on Sony Xperia Z smart phone.
Given below are screen shots from Hangouts app settings.
So, if your SMS receiver stops working all of a sudden do make sure Google Hangouts is not the culprit.
Android KitKat has got its own style of handling SMS messages, but still I don't see a point in why Google Hangouts will break 3rd party apps that need to only read SMS messages.
On a side note, I did think once that maybe this error is caused an up version of Android because my app was working well on my older QMobile A50 which sports Android Jelly Bean 4.1.3.
In case you're wondering what permissions are needed to make a new SMS broadcast receiver work, well I got the following:
<uses-permission android:name="android.permission.SEND_SMS" /> <uses-permission android:name="android.permission.RECEIVE_SMS" /> <uses-permission android:name="android.permission.READ_SMS" />
Monday, May 12, 2014
Disconnect Block Drop calls Android 4 and above
The internet is littered with forum posts and articles that tell you it is impossible to block, drop disconnect an incoming or outgoing call using code starting Android version 4 Jelly Bean because Google placed strict restrictions on MODIFY_PHONE_STATE permission. Only the manufacturer signing certificate can grant you MODIFY_PHONE_STATE permission.
There are a lot of call blocker types scenarios in which we need to shield our user from a bad guy's or sour ex-girlfriend's telephone calls.
The good news is that you don't need MODIFY_PHONE_STATE permission to block, drop disconnect an incoming call on Google Android. The technique described here is available to drop block disconnect incoming calls without using the secretive infamous permission.
Time to disclose the secret sauce. A hint first:
Ever tried to dial a call using ADB(Android Debugger Bridge) shell?
If you've done that, it will be straightforward to disconnect or drop a call using a similar technique.
Time to spill the secret sauce on the internet.
Please check my Udemy course:
The good news is that you don't need MODIFY_PHONE_STATE permission to block, drop disconnect an incoming call on Google Android. The technique described here is available to drop block disconnect incoming calls without using the secretive infamous permission.
Time to disclose the secret sauce. A hint first:
Ever tried to dial a call using ADB(Android Debugger Bridge) shell?
If you've done that, it will be straightforward to disconnect or drop a call using a similar technique.
Time to spill the secret sauce on the internet.
Drop call on Android 4 Jelly Bean KitKat and above.
Friday, May 2, 2014
Android Package Name From APK Java Code Sample
public String getPackageNameByAPK(String _strAPKPath, Context _activityORservice)
Java Source CodeThe Java language source code with android.content.pm.PackageManager to get the package name from a .apk file is shown in this post for online learning purposes.
Android apps are supplied in .apk files(even if you download from the Play store) which contain all information needed to install an app on an Android smartphone.
Once an app is installed on the phone it is identified by a unique package name; the package name format is:
- com.usrax.ca
- com.honestitconsultancy.patric
- mysymphony.pmi.com
This value is taken from the Manifest.xml file which is already present inside the .apk file of an Android application(app).
If we search "get package name from .apk" on Google we won't be able to find the source code to do this on the first page; almost everyone tries to tell us that this will be done through the command line.
This post will answer the following question:
Android, get the package name from apk file in your program
Package Archive files
There is a little twist behind these search results, is there another name for .apk files?Yes sir, the full name of .apk files is "Package Archive". You can say that's the legal name .apk is only a nickname used by the Linux OS (Android is a Linux) and developer community.
Thursday, February 6, 2014
GROUP BY Date Time, Day, Month, Year, calculate SUM function in SQLite for app developers
SELECT strftime('%m', trxDateTime) as valMonth, SUM(trxAmount) as valTotalMonth FROM trx_log WHERE strftime('%Y', trxDateTime)='2014' GROUP BY valMonth
Given above is the query, which will be explained in the blog below; continue reading for further details.
I have a database table that contains a few fields like transaction date, which is a string representing date time, transaction amount, and transaction status in an SQLite database present on an Android device. The SQL Lite database contains a table named "trx_log" The table has fields _id int, trxDateTime text, trxTargetNumber text, trxAmount number, and trxStatus text. A graphical representation of the table structure is given below:
![]() |
SQLite Table used in the example of GROUP BY date, time, month, year, and SUM function. |
SQLite Query Sum and Group By Year
How to calculate the sum of all transactions that took place in 2014? What is the SQLite query for the group by results by year and calculating a sum? We will combine SQLite aggregate function SUM with GROUP BY Clause.
SELECT strftime('%Y', trxDateTime) as valYear, SUM(trxAmount) FROM trx_log WHERE valYear = '2014' GROUP BY valYear
Subscribe to:
Posts (Atom)






