I am busy with notifications, and I was wondering how I could archieve such thing as in the image below. I tried setting it as ongoing, but it didn't quite archieve the functionality I would like it to be.
How can I place my notification beneath that divider? (So above or under USB for charging)
Set your notification to PRIORITY_MIN:
builder.setPriority(NotificationCompat.PRIORITY_MIN);
Related
I would like to take a photo with MediaStore.ACTION_IMAGE_CAPTURE intent, but disable the settings button in the top-left corner. I was able to find a EXTRA_SHOW_ACTION_ICONS parameter, but it is not well documented. This is the description:
The name of an Intent-extra used to control the UI of a ViewImage. This is a boolean property that specifies whether or not to show action icons.
Even if I set it true or false, nothing changes. What does this parameter do? I use it like this:
takePictureIntent.putExtra(MediaStore.EXTRA_SHOW_ACTION_ICONS, false);
I would like to take a photo with MediaStore.ACTION_IMAGE_CAPTURE intent, but disable the settings button in the top-left corner
As I have pointed out previously, you do not have control over the UI of a third-party camera apps. There are hundreds of such apps; none have to give you any ability to control their UI.
What does this parameter do?
Based on a search of the Android source code, it does nothing in Android itself. If the device happens to have the AOSP Gallery app installed, it appears to control something in the image viewer there. It is certainly possible that some non-AOSP apps use that extra for some particular reason, but that behavior would vary by app.
Is it possoble to rotate the whole android userinterface on an eventlistener ?
For example an app which runs in the background and after putting the headphones in the whole interface turn 180° until you put it out again.
Yes it is possible to change layout programmatically (Although not sure about 180 degrees?).
See this link: Change Screen Orientation programmatically using a Button
The first answer he has explained how to change layout programmatically instead of setOnClickListner you can use your eventListener.
EDIT: Look at this:
https://developer.android.com/reference/android/content/Intent.html#ACTION_HEADSET_PLUG
Its the broadcast which takes place in the event a headset was plugged in.
Is there a way in ICS or Honeycomb to go completely full screen? I want the system UI completely gone! Currently what I do is:
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.main);
getWindow().getDecorView().setSystemUiVisibility(View.STATUS_BAR_HIDDEN);
But this results in the Status Bar being replaced by really dim dots! I want it completely gone! Lets say for example I want to play a video or show a picture that takes up the whole screen. I'm okay with the status bar coming back on user interaction but I need it completely gone when there is no user interaction.
With the code above. I get the following look:
I want the dim dots gone as well and my video / image to be completely full screen.
This is not possible in Honeycomb, but has been added in API v14. Use:
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
See the more detailed answers over here (though I would use a Build.Version.SDK_INT check instead of the suggested reflection-based check for support):
Hide ICS back home task switcher buttons
As the previous poster Suggested, that is completely impossible without rooting your device and performing some somewhat dirty process kill operations. The reason for is that new Hardware (like a tablet, for instance) may not have hardware buttons for navigation - and so by hiding those buttons the User would have no means of doing things that they are supposed to be guaranteed to be able to do, like going to the home screen, or accessing device info. Whether or not you might agree with that reasoning, such is the API.
The last information I have is that you can use the black tape to cover it. That's the suggestion given by Chet Haase. Watch this google IO 2011 session Q&A starting at 53minutes
You want SYSTEM_UI_FLAG_HIDE_NAVIGATION . Keep in mind that since the soft navigation buttons are key to device experience this only hides the buttons until there is some user interaction. If you want to permanently hide them then rooting the device (as others have suggested) is the only way to go.
The flag was added as of Ice Cream Sandwich, API 14. Previous to 14 a flag STATUS_BAR_HIDDEN was added in Honeycomb, API 11 that had a similar function. Previous to that the soft navigation buttons didn't exist, so fullscreen modes were handled entirely by Themes (specifically Theme.NoTitleBar.Fullscreen).
Use:
if( Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH )
mBaseLayout.setSystemUiVisibility( View.SYSTEM_UI_FLAG_HIDE_NAVIGATION );
else if( Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB )
mBaseLayout.setSystemUiVisibility( View.STATUS_BAR_HIDDEN );
I want to have fine control over a MoPub banner ad which appears over the top of my game app screen at specific times and not at others. My code currently looks like this (simplified):
LinearLayout linearlayout_for_banner = new LinearLayout (this);
mAdView = new MoPubView(this);
linearlayout_for_banner.addView(mAdView);
The linearlayout_for_banner is transparent, so when there is no advert, the user can see all of the game-play screen underneath. Then at a certain precise point I wish an ad to appear. At the moment, the only function I know to call is mAdView.loadAd() which as far as I know begins a process of going to the internet to seek an ad, then if it finds one it will be drawn on the screen. This is very unsatisfactory, because there is often a delay before it appears. So what I would like are functions like scoop_an_advert_but_dont_show_it_yet() and now_show_that_ad_you_scooped_earlier(). Do they exist? Mopub's documentation seems rather inadequate on this.
Try browsing their github wiki: https://github.com/mopub/mopub-client/wiki/CustomEventsAndroid
You want their, "onReceiveAd" method. Check it out, seems like exactly what you need.
There's no problem with preloading ads and not showing them until a specific time. You can use loadAd() for this. Just swap the visibility of the view when you want it to appear.
NOTE: If you do, you should set that particular ad to not "refresh every x seconds" on the mopub site. Otherwise, it will end up as unintentional ad fraud, since the ad will be refreshing itself while invisible(not to mention tank your CTR).
If you have other ads running in the app without this requirement, I'd recommend a separate ad unit for your sometimes-invisible one, so you can still do the refresh on the other one.
I am very new to programming and would like to know what is the best way to go about creating a notification icon badge similar to the ones on the iPhone apps. This would be basically for creating a badge for the notifications that end up in the notification bar.
This is actually an answer from Mark Murphy:
For most phones, you use the number field of the Notification object.
See here:
http://github.com/commonsguy/cw-android/tree/master/Notifications/Notify1/
Now, there are a few phones by one major device manufacturer that have
a bug, whereby the number field is ignored. I am working on getting
them to fix it. So you can't absolutely rely on that red bubble being
there, though it will be on most phones.
Are you talking about a graphical icon? I created a transparent PNG using the gimp and pass that drawable id as the 1st argument to the Notification constructor.
Notification notification = new Notification(R.drawable.someicon,title,System.currentTimeMillis())
I know this is very old question. May be this link is helpful is you are still looking for answer. https://github.com/leolin310148/ShortcutBadger