Popup on AOD and Off Screen - android

I just port my notfifcation class to Oreo and got a question how do Whatsapp and over Apps show a small popup on AOD or if the screen is completly off ? Because the popups look the same as I think I thought that this maybe a standrd thing, but did'nt found anything about this in the notificastion section of the developer doc. This is how looks like:A snapshot of a Whatsapp Msg and below another Message from a Settings dialog

OK, I found it. I must wake the screen before sending the notification, than it looks exactly like the snapshot's. If somebody is interested I can post the code.

Related

What's X_AUDIO_DEFAULT_SERVICE_CHANNEL?

My wife has tiktok on her phone, it's an old Huawei Nova 3i, suddenly the notification of receiving a message changed. After I played around with the notifications' sounds I changed that of a direct message, however and scrolling down, I noticed another enabled notification sound named:
X_AUDIO_DEFAULT_SERVICE_CHANNEL
I disabled it, looked it up online as "what's X_AUDIO_DEFAULT_SERVICE_CHANNEL"
I found this link:
https://mogua.co/view_file/?file=X/C67006QSk.java&md5=61e8aae62e843b22cf9dc1cbe9f6e82e&type=apk&appname=TikTok&lines=126,142,128
I urlscanned it, then scamadviced it: nothing
Opened it: saw some code in there
Not sure what it is, any professional opinion, please!
Should we worry about her data?!

Can an app read information from the lock screen?

I should start by saying that I'm not (yet) an Android developer. I've got a very specific, personal task that I'd like to achieve. If what I want to do is possible then it will be worth me learning enough to make it work. If it's impossible then I'll stick to what I already know!
I have type 1 diabetes and use a medical app which displays my blood glucose level on an Android phone's lock screen. There's a screenshot below. I'd like to be able to capture the information (particularly the number in the red box) and use it in other ways.
I've tested another app that reads Android notifications, but it only seems to have access to the popup messages that appear from an app. It doesn't see the persistent notifications on the lock screen.
So... is it possible for an app to read those lock screen notifications?
Thanks in advance for your help.
Yes that is possible with NotificationListener:
https://developer.android.com/about/versions/android-4.3.html#NotificationListener
The flags FLAG_ONGOING_EVENT or FLAG_NO_CLEAR will let you know if a certain notification is persistent.
Here is a sample project that I found useful demonstrating NotificationListener. In the NotificationListenerExampleService.java, you can simply change the onNotificationPosted method to find out if a notification is persistent:
#Override
public void onNotificationPosted(StatusBarNotification sbn){
if (sbn.getPackageName().equals("package name of your desired app")) {
if (!sbn.isClearable()) {
Notification notif = sbn.getNotification();
// get your desired data in the notif object
}
}
}
Note that you can see the package name of an app by just simply going into its Google Play store page, and in the url you will find something like this:
https://play.google.com/store/apps/details?id=chat.rocket.ne2.reactnative&hl=en_CA
where the id field (chat.rocket.ne2.reactnative) is the package name.

How to add an element to the pull down notification bar of an existing app?

I want to add a mark as read option to the pull down notification bar of Gmail but I don't have the slightest clue about where to start. If somebody can tell me how to do it or point me in the direction of the right docs to pull it off it would be much appreciated.
I know it is possible because it has already been done, but I want to do it by myself.
That's quite an undertaking.
So the link you provided has a bit of a walkthrough in its description about where to start. The trick is that because you're trying to program a notification service for an EXISTING app, you don't really have control over the notifications the app itself creates. I suspect what you're going to have to do is program a NotificationListenerService, listen for gmail notifications, and somehow cancel the gmail notification and replace it with one of your own, as created through the android documentation.
For a good example of how NotificationListenerService works please take a look at this:
https://github.com/kpbird/NotificationListenerService-Example
The canceling is something I have not tested but you asked for ideas, not code. NotificationListenerService has a method cancelNotification(String pkg, String tag, int id) which looks like you can use to cancel the gmail notification.
You can get access to the raw Notification-object using an AccessibilityService. I haven't tried it before to be honest, but I assume you can modify the Notification and add your own buttons, etc.
More information on tinkering with the Notification-object in an AccessibilityService here: https://stackoverflow.com/a/10303676/198996

So how can I see the logs in Jelly Bean?

I used to use an app called Log Collector to see system logs. It would send them to my email or via bluetooth,
However, on Jelly Bean the "read log" permission for apps no longer exists and apps can't read the logs, and Log Collector is obviously no exception.
So does one now need to root the device to see system logs? There must be a way for the user to read them. I don't need to access them from an application, I need to read them as a human being. Is there a way?
I got the answer in this google groups thread:
https://groups.google.com/forum/?fromgroups#!searchin/android-developers/READ_LOGS/android-developers/6U4A5irWang/8xOi74KfRIYJ
the message by Mark Murphy replying to Matteo Sisti Sette (which is me).
(it doesn't seem to be possible to link to a particular message, is it?)
POWER + VOLUME_UP + VOLUME_DOWN will generate a report and a screenshot that you can send via email or upload to Drive (ridiculous you can't share it in an arbitrary way such as send via bluetooth or open as text file, but anyways).
(seems you have to hold them for a while and the action is launched when you release them)
At first I thought he was making fun of me and that would just reboot or something, but then I tried and it works.
Quote from Google+ and credits to +Ian Clifton :
"If you go into the developer options of a device running 4.2, you can check the box to add the Bug Report option to the power menu. This also adds it to the quick notifications menu (not sure of the proper name, but slide down the notification shade with two fingers on a phone or on the right side of a tablet)."
..and that would be right answer.. Cheers

recognize when application returns from blank screen

Is it possible to get know when my application returns to view for user, after blanking screen? In this moment application calls method onResume, and my application has crash. ("has stopped unexpectedly") I know why and I can repair this problem, but I need to know when application returns from blank screen.
If you're talking about the point when user unlocks the device - ACTION_USER_PRESENT is what you need. If this is not the case - please elaborate and post more details
What do you mean by "after blanking screen" ? like if the screen times out and turns off? Either way it will be mostly impossible for us to help you with only the information you've given. Post the code from your onResume() method, also look in the Logcat and copy the stack trace that comes from the exception you're getting. Post that here too. Once you have done this it is far more likely that we can help you resolve the problem.

Categories

Resources