Android: receiving MEDIA_BAD_REMOVAL notification - android

I have an application that scans the sd-card and make a list of video files stored in it. Then there is an option of playing the video files. All I want to know is
1- How can I register various actions or notifications like Action.Media.Unmount, Action.Media.Bad.Removal etc in my Manifest file
2- How can I use the braodcast receiver in my code.. I have tried couple of codes but they didn't work. If someone can give me of an example here, I shall be greatly thankful..
Thanks all

You really should read the documentation. It's a fairly simple method to register a BroadcastReceiver for those Intents.
Just read here and here.
If, after reading you still have some kind of problem, just say what error are you getting and the code/xml you're using.

Related

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

android-streaming mp3 file to other device

First of all, I'm not good at english. sorry.
What I want to make is music broadcasting service.
When I select music from android device, it sended to the server in real time, and server broadcasts it to another.
But I don't know how to send mp3 file to server in real time.
Can I get some ideas or samples?
Please help me....I searching for example codes for a long time but I can get anything....
I have tried AudioStream, but it looks like can send MIC only.
When you select a music file, mp3 for instance, there will be no ACTION broadcast. So you can't capture this operation through BoradcastReceiver.
You can create an app for user to choose when they select a music file, then you can send the file to server as you like in your app. This can be done by adding intent-filter in your Manifest file.
Hope this helps you.

how to show the media dynamically according to the content(video/audio/picture) sent from Android app to receiver in chromecast

In chromecast
i want to send different kinds of url(mp4/mp3/png..) to the receiver,but how does the receiver to show them dynamically?
this is: how does the receiver recogonize what kind of the RemoteMedia received?
In the current version of the SDK, there is nothing from the framework side to help you with that directly. You can include the mimetype in the metadata and retrieve that on your receiver and do as you see fit. That said, if your media is only audio or video, things are better since the video element can handle both and you can just treat them the same but for images, you have to do some other work. Another approach is to look at the extension and try to guess the type but that is not fully reliable.

Is it possible to get latest missed call or received sms notification from a class which we created on android?

I am able to see getting new sms or calllog from apks which I built but my question is that;
for example I create a .class which in
<com.example.xx
Can I use it on my any other apk's layout xml file using <com.example.xx ... /> using with layout width and height.
Is that possible? If so can you create this class file ?
( I know manifest needs receiver and permissions for latest missed calls & messages)
I hope I can explain clearly what I mean
I'm also not sure what you're asking, but...
Yes, you can access the latest sms or the call log from any Activity you want, from any apk you want, and/or from pretty much from anywhere you want on the phone.
You'd use a Content Provider to access that information. If you wanted to, you could even use a Broadcast Receiver to trigger your application whenever you received a message or phone call.
And yes, you could even do this in a library if you wanted (so that others could use it from their own layouts). If that's what you're asking.
And yes, you could even do this from one apk to another apk through intents if you wanted (not that I would see any advantage to doing that). May be, that last one is not what you were asking.
Have I answered your question?

USER_PRESENT Intent for GO Locker

My app listens for the USER_PRESENT intent. However, custom lock-screen-replacements, such as WidgetLocker and GO Locker don't/can't send this protected broadcast.
WidgetLocker provides a workaround to this by broadcasting its own custom intents (e.g. com.teslacoilsw.widgetlocker.intent.UNLOCKED, see here). Does GO Locker provide similar intents? I wasn't able to find any information on this.
I hope you don't mind that I'm posting this so late in this thread, but I needed to do exactly the same and found the Intent actions which they are using:
com.jiubang.goscreenlock.unlock
com.jiubang.goscreenlock.appunlock
com.jiubang.goscreenlock.close
Please note that I only managed to get the first one to work. I never saw the other two fired by GO Locker, but the second one looks like it could be used in some cases. Last one seems a bit ominous/unclear, so use it at your own risk.
If anyone is interested how I found these then it was by decompiling the GO Locker APK with apktool and grepping for package name patterns in the smali files (thank you for not being able to obfuscate string literals!).
Which version of GO Locker are you using? Send me the .apk file and I may help you, cause I have had a similar problem before.wenqs27#gmail.com
I'm using Go Locker 1.35.1 and the intent should becom.gau.go.launcherex_action_send_togolock
which is recieved by com.jiubang.goscreenlock.service.KeyguardReciever
Hope this will help you~

Categories

Resources