I followed this guide https://developers.google.com/admob/android/native/mute-this-ad
I used this code from github googlesamples too mute a Native Ad.
https://github.com/googlesamples/android-ads/blob/master/advanced/APIDemo/app/src/main/java/com/google/android/gms/example/apidemo/AdMobCustomMuteThisAdFragment.java
But how can i get the same dialog as in the first image? Now i'm getting a simple dialog with the reasons.
This is what i want
This is what i have now after following the guide and using code from googlesamples
The GoogleSamples provides only the way to implement the Mute Ad option. Not the UI.
From their example, you only received default short labels (as "Inappropriate", "Repetitive"...) and use android.R.layout.simple_list_item_1 which is the default list item with only a TextView widget. As the first picture, in production they should use custom strings with their own user interface. According to the documentation you linked:
The implementation of the custom mute interface is entirely up to you. You can place a small close button on the ad, or you can provide some other interface for the user to opt to mute the ad.
The solution might be to map the reasons with your own labels in MuteThisAdReasonWrapper into toString(), and use a custom list item instead of simple_list_item_1.
Did you set it to setRequestCustomMuteThisAd(false) and then check nativeAd.isCustomMuteThisAdEnabled() whether its getting set , So that you can confirm that its not enabled.
Moreover check once, If you are building the adloader after you set it to false .
adLoader = new AdLoader.Builder(context, "ad unit ID").withNativeAdOptions(new NativeAdOptions.Builder()
.setRequestCustomMuteThisAd(true)
.build()).build();
adLoader.loadAd(new AdRequest.Builder().build());
Related
I'm making a settings activity in my Android video playback app and I want to know if it was possible to enable/disable PIP(Picture-in-Picture) mode programmatically.
To clarify I am fully aware that this setting can be change via application advanced settings or via special app access, but I want to leave that as a last resort. (If there are no other alternatives).
Further more this Activity is isolated from the video threading page itself.(Meaning the user would have to stop the video entirely before coming to this page).
Main reasons I want this is an extra reminder that this app supports this feature and also if the user forgets where to reactivate this function.
Think of it as: Adding another layer of user friendliness
Here is a way to check the setting:
AppOpsManager appOpsManager = (AppOpsManager) context.getSystemService(Context.APP_OPS_SERVICE);
return (AppOpsManager.MODE_ALLOWED == appOpsManager.checkOpNoThrow(AppOpsManager.OPSTR_PICTURE_IN_PICTURE,
context.getApplicationInfo().uid, context.getPackageName()));
I haven't tried setting it programmatically, but this could be a starting point for you.
Since using Card.io for credit card scanning,
I had to face with some limitations and looking for alternative solutions.
The issues;
1- Is there any way to customize 'KEYBOARD' button on scanning screen?
2- Is there a way to start my own view after clicking on 'KEYBOARD' button?
3- Is there any way to start my own view after scanning the card for entering expiration date, cvv, card holder name?
It doesn't look like the Card.io library provides any way to modify the text of that button.
It doesn't look like they provide any way to hook your own logic into the button either.
On iOS, it's possible to use the CardIOView class to integrate a card scanning component into your own view which would allow you to implement whatever flow you'd like... but on Android, there doesn't seem to be an equivalent to that class.
It seems like the Card.io library is rather limited on Android, but I haven't yet been able to find any viable alternatives that support both iOS and Android.
I am developing an App that has a lock screen widget where it has a play, pause, prev and next. When I connect my phone to an Android wear, it automatically shows this buttons and it works fine. I would like to add a "Like" button that would automatically be shown on the lock screen and the android wear. I know that I can create a Notification and add action for the like. But I want to know if is it possible to achieve that using only RemoteControlClient?
Have you tried using rating with the flag FLAG_KEY_MEDIA_RATING ? It seems that it's the only way to maintain generic methods and avoid having to set custom code on the wear side (or through notifications).
This flag can be set with setTransportControlFlags
Flag indicating a RemoteControlClient supports ratings. This flag must
be set in order for components that display the RemoteControlClient
information, to display ratings information, and, if ratings are
declared editable (by calling addEditableKey(int) with the
RATING_KEY_BY_USER key), it will enable the user to rate the media,
with values being received through the interface set with
setMetadataUpdateListener(OnMetadataUpdateListener).
Unfortunately, few or not example exists on the web. I discovered only one (unanswered) question relative to this on SO :
Android 4.4 KitKat Rating API
I'm trying to show some information about the currently casted media inside the cast menu like this. The example apps provided by Google are using the CastCompanionLibrary, which won't be available in my project.
There isn't any hint in the Development Guide, so I really hope that there is anybody out there who knows how to do this.
Thanks in advance!
You need to write your own MediaRouteDialogFactory which needs your MediaRouteControllerDialogFragment which needs your MediaRouteControllerDialog.
Then use it via [Cast Icon] or [action bar menu item].setDialogFactory(yourMediaRouteDialogFactory).
Best to take a look at the Video Sample App.
Is the question about how to get info, or you are also asking about how to show a custom dialog when a cast icon is clicked on *while casting)? As for information, the image you referred to currently shows (a) some metadata about the media that is playing there (icon, title, ..) and (b) the playback status (paused/playing). These info are available from RemoteMediaPlayer.getMediaInfo() and getMediaStatus(). You should also register the dialog to listen to updates to media status and metadata so when the dialog is open, it can reflect the changes.
CCL is just a wrapper around the SDK apis so you can look at its code to see how it is using the SDK apis to accomplish these tasks.
i would like to ask a question with regards to AlertDialogs which i would like to use in GoogleMaps V2. I read about the custom InfoWindow documentation from the android developers and noticed that they advised not to put any interaction widgets (Buttons, Textbox etc etc) onto an OnClick function. Now, i would like to know if i could use a default alert dialog and put it into an OnClick function for the custom InfoWindow. Is it possible?
Yes that should work fine. The reason why you should not (and cannot, really) put interactive elements in an InfoWindow is because the InfoWinow is statically rendered when shown, making any interactive elements you place in it effectively useless.