How to read/intercept USSD message coming on Android phone - java

So unil this point all I can figure over was that until Android 4.2.2 there were two ways available to us :
Use the logcat and extract information from it
Runtime.getRuntime().exec(
"logcat -v time -b main PhoneUtils:D");
I used this code to read the logcat and find out the displayMMIComplete message here
Use the provided intent named com.android.ussd.IExtendedNetworkService and listen for this intent and do you task.
So what I've acknoweldge until now is, Since 4.0 onwards this intent has been removed and since 4.2.2 onwards printing of USSD message info in the logcat has been removed?
Am I right until here?
And secondly what's the hack or solution now to read the USSD message, there must be some way we can get through it?

There is no Android-framework provided API yet which can be used to "read/intercept" USSD Messages in a Portable way.
The 2 approaches that you mentioned is what was available till now, but as you mentioned, support for it is dropped from Android open source project.
There is a request/discussion going on, which clearly shows that many developers are requesting this feature, but so far there is no update/communication from Google's side to explain future roadmap about adding support to "read/intercept" USSD Messages in a Portable way.

Related

Android GCM not letting me sleep

I've made two apps to work with GCM notification in one I've done that using my own php server to store reg ids and then send notification to app users using GCM . and i've coded it myself in java also to receive that notification successfully i've done that using documentation of Google Cloud Messaging
So in 1st app which i coded manually i'm getting all notifications as i was expecting then there was problem that screen was not getting on while i receiver notifications . I've accomplished that also using WAKE_LOCK.
Even my app not present in ram of device which we mostly now a days we use hold on menu button and clear ram.
but still i get notifications.
Ok so here 1st app story ends.
Now let's go towards second app
I've made that using https://onesignal.com SDK
That was so amazing and easy and i've done it earlier.
just this line of code did all.
OneSignal.startInit(this).init();
So every thing is working and all is done . But problem is that when this app is cleared from ram like i defined above i don't get even single notification then to be sure more i check my cell phone running app section and i was not able to find my 1st and 2nd app there but i found google play services running 5 services when i tapped on that i got that gcm is also running . So i'm not getting that what can be the issue with 2nd app ? what i should do to make it like 1st one with this sdk
I'm really very worried and any help will be appreciated thanks.
Just to confirm in your 2nd app with OneSignal you are sending a new notification from OneSignal each time? If you're replaying a GCM payload the OneSignal SDK will omit processing it to prevent duplicates.
Which device and Android version are you seeing this issue on? Test on multiple OS versions if possible.
Also check the logcat when you kill your app and when you send a notification from OneSignal. It sounds like your app could be getting put into a "Force Stopped" state. See the following gist for an example of the logcat messages that show from this.
https://gist.github.com/jkasten2/fb83b1df754cf26df378
Thanks.

Android - How to prevent sms every 1 second?

I'm in an android project that in this I wanna prevent sms from some numbers that receive messages before go into inbox per second. Now I help that guide me how I can work this project programmatically?
I see some sample codes but I don't know how I can...
You can't do that on modern versions of Android. On older versions you could, but as of 4.3 or 4.4 Android introduced the concept of the default sms app. Only that app can write to the SMS database. And you cannot programatically set the default SMS app, only the user can set it manually.
Now if this restriction is ok with you, you can do it as the default SMS app. Whenever you receive an SMS, you need to write it to the database. If you don't write it, it won't appear in the inbox. You can then decide when to write messages or even to silently delete messages.

Using 10.8 Notification Center in Java

this is just a general question. I'm not having an actual project or something else where I want to do this.
Is it possible to build an App in Java and add some framework stuff or something else and use Notication Center?
I wrote a simple C -> Objective-C shim .dylib that exported a function showNotification That delivered a notification immediately.
Then I wrote a JNA wrapper to the function exported in the dylib. I'm sure that you could use a combination of Rococoa and JNAerator to eliminate this dylib altogether.
Then I wrote a simple java application that I turned into an app bundle. This is the important point. If your java application is not in an app bundle then notifications will not be delivered.
Messages delivered to the notification center.
It's eminently doable, you just have to play along with the rules of the NSUserNotificationCenter - it must be in an app bundle.
I used java 7, update 9 for this. Another question seems to have had even more success.
The code used to build this simple application is available on github. It contains an xcode project for creating the .dylib, and a netbeans project that makes use of the .dylib to deliver notifications.
I' ve found a solution that might work for you, you can use Apple script to show notifications on osx, try this:
Runtime.getRuntime().exec(new String[] { "osascript", "-e", "display notification "This is a message" with title "Title" subtitle "Subtitle" sound name "Funk"" });
You can read about Apple script's notifications in here
One possible solution will be Growl when the App will be updated to Growl 2.0 which will forward Growl Notifications to the Notification Center.
Informations about Growl 2
Growl Messages can be forwarded with the current Versions by using MoutainGrowl
Growl can be used under Java with libgrowl or jgntp
Maybe it's not the cleanest solution and it has some requirements to the user but it's definitely one that works
I suggest you take a look at how IntelliJ IDEA handles notifications in MountainLionNotifications and GrowlNotifications.
As suggested in other answers, it uses JNA to manipulate NSObjects.

Showing all broadcast events on Android

is it somehow possible to show all broadcast events/intents that are triggered in android? I just want to know if I can quickly figure out if an application is using intents/broadcasts I can hook into. For most of the stock android applications I can read the source but is time consuming.
List all historical broadcasts and registered broadcast receivers with the following terminal command:
$ adb shell dumpsys activity broadcasts
Please check this open source project to see all broadcasts on your android phone:Broadcasts Monitor Pro
There's logcat, which you can get to from the ddms (either the dedicated app, or the eclipse view), it should list all broadcasts, as well as the properties that are associated with the intent. However, as the other commenters on your post have stated, you really shouldn't be doing that unless the intent has been published. It may change, or cause other forms of havoc. Although I disagree with the statement, some people may even go so far as to say that it's illegal if the licenses aren't compatible. (Although I'm of the party that it's not, seeing as you're not statically linking to the code, nor even putting it in your package).
The best tool I found was Intent Intercept that catches the intent on the fly and allow you to inspect the content

Android: Installing Wikitude on Android Emulator

I'm trying to write some apps using wikitude, and I'm having some problems running even the example.
I've put the sample ( BasicOpenARDemo ) that comes with the SDK inside eclipse and tried to run it, where I encountered the next error: "wikitude was not found on the system. Please press the ok-button to access the Android market and download wikitude."
First question- I don't understand- Why am I approached to download the utility when I have a standalone sample inside my eclipse? Doesn't the core files behind Wikitude come with the SDK or the sample itself?
The next question will be - after some googling, I've found that in order to install this "Android market" I need to follow the manual that comes in the 9th message in the next thread (the message that was written by ronni.rasmussen) -
http://forum.xda-developers.com/archive/index.php/t-529170.html
Well, I've followed it, and now when I try to press the OK button that comes after the "wikitude was not found on the system..." message, I get redirected to the Android market, where I find Wikitude, but when I try to download it- I get a "Download was unsuccessful. Please try again" error message. How do I fix that?
One more thing that I don't understand- How come it's written in this offline Android market that the available wikitude version is for android 1.5 and no longer maintained?
As you can see- I'm quite baffled here. Hope someone could clear this up for me.
I was with the exact same problem. The problem was that installing Wikitude from the market (following the link you provided) does not guarantee to have the system requirements supported in the virtual device, therefore it gives an error when you run the BasicOpenARDemo, if it let you install it at all.
The solution was creating an AVD with an GoogleAPI (it includes maps support, I used the level 10 API for Android 2.3.3, it didn't work for the level 8 API), adding the camera, accelerometer, compass, GPS, etc., support to the virtual device (I did this via Eclipse). Then I downloaded the .apk for Wikitude and installed it via command line (.adb).

Categories

Resources