kotlin admob ad not shown - kotlin

I try to add adMob Intersiciel in app in Kotlin
I ve follow the docs (https://developers.google.com/admob/android/quick-start and https://developers.google.com/admob/android/interstitial#kotlin_1)
But the ad is not shown(But no any error on the app in the emulator) So I need of your help.
I think the problem is come from "Set the FullScreenContentCallback"in the doc. Could you confirm that the code need to be in a function eg loadAd and "Show the ad"in a function showAd"which to be call when needed> Or maybe do you know a tutoriel to find the solution to my problem. Thanks

I have found the problem> When I test with an test id ad mob, I have not the ad show at each time> I don't know why> So my problem is solved

Related

Add time on ohmyzsh console on robbyrussell theme

Very simple problem, i would like to see the time when i prompted my commands in the ohmyzsh console. I use the robbyrussell theme and would prefer to keep it if possible.
Thanks !
You can try
PROMPT="%D{%m/%f/%y}|%D{%L:%M:%S}"
See more at https://superuser.com/questions/943844/add-timestamp-to-oh-my-zsh-robbyrussell-theme/943916

How to update ad description using pre_item_add hook in OsClass?

I am writing a function to change the external links to my redirection link. I use pre_item_add hook, but I don't know how to update the submitted description with the new one. Does anyone know how to do it?
This is my idea:
function link_process($aItem){
$desc = $_POST['description'][$language_code];
Session::newInstance()->_setForm('description' , rewriteExternal($desc));
}
osc_add_hook('pre_item_add', 'link_process');
I made a similar change described here
Look for point 8. In my solution, but read all the answers to understand. Also there is a link in the solution to where I got this idea.

Camera.open() is not working android

I am trying to write a custom camera application in android.
For that I need to open the camera application.
for that i am tring following code..
Camera camera = Camera.open();
but is showing error like
method open undefined for type Camera
i did as suggested here http://developer.android.com/reference/android/hardware/Camera.html#open(int)
any suggestion..
Thanks,
Ravindra Gupta
You most likely imported the wrong camera class at the top of your source file, which is android.graphics.Camera.
You need android.hardware.Camera instead.
Thanks
I think you have not added the camera permission. See below - you need to add this in your manifest;
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />
Check your imports. I had a similar problem and the Camera object Eclipse chose for me was: import android.graphics.Camera; instead it should be: import android.hardware.Camera;
If none of the above work:
check to see if you are requesting camera permission manually. Newer Android permissions (API > 23) are set at runtime, not install time.
See: https://developer.android.com/training/permissions/requesting.html
Please create a variable like this:
android.hardware.Camera camera ;
and then try open method :
camera = camera.open();
// this is working on my android studio
I have Faced the same problem till i reached that older versions of android will work properly until Android Marshmallow so it needs a runtime permission in order to proceed and show the camera ...
you can read about it in this link https://developer.android.com/training/permissions/requesting.html
for me i used a 3rd party library to do all this stuff for me from this link and all resolved ..
https://android-arsenal.com/details/1/2804
Hope it helps
I have faced a lot of issues while using integrating camera native/camera2 api. The code was bulky. To avoid complexity and compatibility issues google provide new CameraX api in new android jetpack library. See the google provided documentation https://developer.android.com/training/camerax. There is also a Kotlin based library i found on github https://github.com/robertlevonyan/CameraXDemo. You can get more clearity with less code.
Waged right!!!
A permission request is required. And I found the right code. he works.
I advise you to look at this article to initially connect the camera:
https://habr.com/ru/post/112272/
enter image description here
if(ContextCompat.checkSelfPermission(MainActivity.this, Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(MainActivity.this, new String[] {Manifest.permission.CAMERA}, 15); }

chrome.extension.onMessage is undefined

I have a simple plugin that just does something like this:
chrome.extension.onMessage.addListener(function(msg, _, sendResponse) {
log("Got message from background page: " + msg);
});
unfortunately when my panel is loaded the following error is shown:
TypeError: Cannot call method 'addListener' of undefined
and according to my tests chrome.extension.onMessage is undefined
According to this page http://code.google.com/chrome/extensions/messaging.html I should be able to access this chrome API from my page so it has to be something small that I am missing here...
Please note methods chrome.extension.onRequest and chrome.extension.sendRequest, as originally suggested in this answer, are deprecated as of Chrome 33.
You should use
chrome.extension.onRequest
instead of
chrome.extension.onMessage
And in background page or any other extension scripts:
chrome.tabs.sendRequest
instead of
chrome.tabs.sendMessage
( the documentation is outdated... alert to google team ;) )
Just a side note: the Yandex browser (mostly oriented for Russians) which is also based on Chromium still (as of 11/10/2012, ver. 1.0) has the .*Request methods instead of .*Message. Many thanks to Ciprian Amariei for the tip, it saved me a lot of time!
PS: This should actually be a comment to Ciprian Amariei's answer but unfortunately I can't leave comments yet and I though this information could be very helpful to those who develop extensions for Yandex browser.
Make sure you're using the latest Google Chrome version. Older versions don't have the chrome.extension.onMessage API.

Sleak SWT tool, Device is not tracking resource allocation

I'm having trouble in testing an RCP application with Sleak because it does not display anything, it only shows the message "WARNING: Device is not tracking resource allocation".
I've setup Sleak from this tutorial and I don't know what's wrong.
Does anyone know a solution for this? Thanks in advance.
Do you have the correct version? Can you see the sleak view in your RCP-application? If not make sure it's in your launch configuration. Also double check that you have set the
org.eclipse.ui/debug=true
org.eclipse.ui/trace/graphics=true
correct in the tracing tab. There are properties with similar names.
You can write
org.eclipse.ui.internal.misc.Policy.DEBUG_SWT_GRAPHICS = true;
org.eclipse.ui.internal.misc.Policy.DEBUG_SWT_DEBUG = true;
before
Display display = PlatformUI.createDisplay();
This will create in Workbench.createDisplay() method
new Display with data tracking.