Android App Detect Other Activity - android

I've been trying to look up solution but I just can't seem to find one that suits my need. It could be that I'm not using the correct keyword, so I'm gonna try to explain it the best I can.
Simply saying, I'm building an Android application. The application need to detect some other activities on the phone and show some message.
For example:
User launch MyApplication.
User received some notification from another app. (a phone call, text message, email, whatever)
MyApplication shows a message via toast or dialog, saying that "you just received an notification from another app"
I'm not entirely sure what function I should be looking for here, any help is appreciated.
Thanks!

You will want to look at NotificationListenerService, this will let you receive calls from the system when new notifications are posted or removed, or their ranking changed.
Once you receive a callback from the NotificationListenerService, you will want to create a Toast.
Take a look at this tutorial should help you get started.

To detect when other apps ask the OS to display a Notification, you would need to implement a NotificationListenerService. The user would then not only need to install your app, but also go into Settings and specifically allow you to monitor notifications.

Related

Rich parse messages with push notifications service

I'm using Parse service in an application I'm developing, push notifications are now working, I can send perfectly ...
But I want to implement some actions in determidos cases example: Send url to be opened as soon as the user clicks on the notification, make a call, open the map with a planned route, and more.
I wonder if this is possible, and if we had someone who already knows the way I should go.
Thanks!
You can certainly send additional information to trigger an event inside your app, such as url opens, opening maps, etc.
First, you need to send a payload with your push notification that tells the app what to do. You can learn about that here:
https://parse.com/docs/push_guide#options/Android
Second, you need to create a handler inside your Android app that recognizes your push payload and knows what to do with it. You can find the appropriate start under "Responding with a Custom Activity" here:
https://parse.com/docs/push_guide#receiving-responding/Android

Are there things like an Android trigger

I have never developed something in Android before, but now my company has put me on a project which includes android.
My question is this: Is it possible to write an application that runs in the background and waits for triggers (if that is the correct word for it). For instance lets say I want my application to do something as soon as you open your emails or as soon as you get an email. Is there some API that I can use to interact with other applications such as Mail. The application does not have to have any GUI, it will literally just push some information notifications on the mail just received or opened.
I don't require a to technical answer, but rather just yes or no, and indeed yes, where can I get more info on it. Also if it is not possible, is there some workaround to achieve this. I have googled it, but most of the links are how to send an email from your application.
Thanks
EDIT: So it can even be triggered when a notification is received. Then I just want to look at the notification and determine if it is an email?
You could register BroadCastReceiver for the actions that you need to be caught

Android/iOS programming to trigger an action

Is there any possibility to trigger an action on Android?
Like if we send a message to an android phone, it should execute some instruction, like running an app or something.
Is it possible with Android? Or iOS?
Or can the event be anything like reception of an email or phone call from a specific number or anything that can be done remotely?
Something as shown in the link here. But I want to know how to program these triggers.
Can someone help me out, please?
I want to manipulate the network settings so that it can automatically switch on the Wi-Fi or data and send back some data. Is that possible?
Yes you can trigger an action on android.
For that, you need to use a broadcastreceiver (here is a good article about how to use it http://www.vogella.com/articles/AndroidBroadcastReceiver/article.html)
Here is a simple example of the source code in order to display a message to the user when a sms is received.
http://androidsourcecode.blogspot.ch/2010/10/receiving-sms-using-broadcastreceiver.html

Is there any way I can read the notifcations that appear in my android home screen Notifications tab using java code?

The android home page displays notifications from different applications.
I would like to read those notifications using my program.
I tried to find information on that in forums and in android help but I was not able to find any information.
My actual goal is to read the notifications and if the notification is about an email from a certain person then I want to perform something in my application.(I use touch down for my email)
Any help is appreciated.
Not possible due to security reasons.
If you want to respond to events then you should try listening to them directly with intents.
You need to create an AccessibilityService and set it to listen to TYPE_NOTIFICATION_STATE_CHANGED events. This way, each time any of the application packages specified while configuring the AccessibilityService generates a new notification, the onAccessibilityEvent callback of your service will be called with all the information about the notification.

How to show confirmation message before opening the default messaging application?

I want user to confirm By selecting yes or no that whether he/she is sure to open the message application or not.
This will be similar to CALL CONFIRM android app which confirms when making a call.
I can also manage if someone let me know a thing like broadcast receiver as in the case of making a call.
Like i would be able to confirm when send button is pressed in message application.
This is my first question on this forum. :)
it can be achieved in more than one way,
create a service and monitor activity stack, if activity matches com.android.mms.* you can show your notification to user
create an application with all the intents for launching the messaging application, you can find out all possible intents from stock messaging application's android manifest file for your ref
http://www.netmite.com/android/mydroid/2.0/packages/apps/Mms/AndroidManifest.xml

Categories

Resources