I’ve been trying without success to get leadbolt ads to show up on an android app I created using phonegap. This is what I’ve done so far:
I have created a notification ad on leadbolt.com, added references to LeadboltController.jar and LeadboltPhonegapPlugin.jar files contained in my projects libs folder.
Added the code below to my javascript file
var Leadbolt = function() { }
Leadbolt.prototype.load = function(data, successCallback, failureCallback) {
return PhoneGap.exec(successCallback, failureCallback, 'LeadboltPlugin', data[0], data);
};
PhoneGap.addConstructor(function() {
PhoneGap.addPlugin('leadbolt', new Leadbolt());
PluginManager.addService("LeadboltPlugin", "com.LeadboltPlugin.LeadboltPlugin");
});
Sometimes I insert the code below in my javascript file or index.html, either way I see no ads.
window.plugins.leadbolt.load(["*********"], null, null);
Am sure people must have gotten this to work on their apps. I would really appreciate any assistance offered.
Thanks alot.
Have you done this:
Open /res/xml/plugins.xml, add following lines:
<plugin name="LeadboltPlugin" value="com.LeadboltPlugin.LeadboltPlugin" />
<plugin name="LeadboltNotificationPlugin" value="com.LeadboltPlugin.LeadboltNotificationPlugin" />
Hey not sure if this helps, but I know Leadbolt released an update to their phonegap plugin and its available in the portal. They put all ads types in one plugin which is much more convenient to use. Have you tried that?
If still not working, you should write to their support with details and they will get an answer for you. I’ve done that and its been very helpful.
Related
I've been trying to open Facebook page using React Native Linking API. It doesn't work for me. I do have Facebook app installed. Here is what I tried:
Linking.openURL('fb://page/<page_name>');
Linking.openURL('fb://profile/<profile_name>');
Linking.openURL('http://facebook.com/<page_name>');
I also tried to use Communications library: Communications.web(url). None works for Facebook and Instagram. However it works like a charm for Google Maps, Apple Maps, Twitter and other big guys.
I was wondering if I was doing something wrong or maybe we should send some Android articles to those people from Facebook on how to properly implement deep linking in their apps? They clearly don't know what they are doing.
Ok, found one way to open Facebook:
Linking.openURL('fb://page/PAGE_ID');
Linking.openURL('http://instagram.com/_u/USER_NAME');
Linking.openURL('http://instagram.com/_p/PICTURE');
In general, you should check Linking.canOpenURL() for iOS before trying to open them.
Also, make sure you add your protocols as an array in info.plist as:
<key>LSApplicationQueriesSchemes</key>
<array>
<string>fb</string>
</array>
You can also do this in your Xcode project in info.plist.
I'm having the same issue, but not able to solve it. I have multiple social networking buttons with the onpress action of onPress= {()=> Linking.openURL("https://www.SOME_SOCIAL.NETWORK")} My buttons linking to Twitter, Instagram, and SnapChat all open the app if installed or a web page in Safari if the app is not installed. The only outlier is Facebook. Given an onpress action such as onPress= {()=> Linking.openURL("https://www.facebook.com/")} the link will always open in Safari even if the app is installed.
Because of this odd behavior I'm handling my onpress action for the Facebook link like this:
```
Linking.canOpenURL("fb://profile/XXXXXX").then(supported => {
if (supported) {
return Linking.openURL("fb://profile/XXXXXX");
} else {
return Linking.openURL("https://www.facebook.com/");
}
})
```
The above code doesn't work as intended, but nothing else seems to.
Update - May 2019
// open via app
fb://facewebmodal/f?href=PAGE_NAME
According to the docs https://reactnative.dev/docs/linking#canopenurl. Promise can be rejected for android. This is my approach to handle this for iOS and android
import { Linking } from 'react-native';
const handleOpenLink = async (url) => {
try {
await Linking.openURL(url);
} catch {
throw new Error('URI cant open:' + url);
}
};
Nothing here worked for me, but with some random tryings, i found this solution working :
Linking.openURL('fb://page/<ID-PAGE>');
And if you are looking for your pageid, here's a little tutorial :
https://roadtoblogging.com/get-facebook-page-id/
Worked for me using these :
facebookApp: 'fb://page/318948148343',
facebookAppIos: 'fb://page/?id=318948148343',
instagramApp: 'instagram://user?username=stackAnswer',
youtubeApp: 'vnd.youtube://channel/UCPHssSTfq-K823dDJnvXqgw',
linkedInApp: 'linkedin://company/google',
Notice the difference between both facebook links (for iOS you must specify the id as param)
Also, don't forget to add equivalent attributes in Info.plist for apps to be allowed, as:
<key>LSApplicationQueriesSchemes</key>
<array>
<string>facebook</string>
<string>fb</string>
<string>instagram</string>
<string>vnd.youtube</string>
<string>linkedin</string>
</array>
I have an iOS/Android app built on cordova 2.6 and jqm 1.3. I need to open a link to an external website after the user clicks on a button. The code I am using is:
var ref = window.open('http://google.com','_self','location=yes');
ref.addEventListener('loadstart',function(event) {
console.log('load started');
});
ref.addEventListener('loadstop',function(event) {
console.log('load stopped');
});
ref.addEventListener('loaderror',function(event) {
console.log('load error = ' + JSON.stringify(event));
});
On iOS everything performs like I would expect. A new browser window opens with the google website loaded. But I cannot get anything to to load in Android. When I click on the button, nothing happens. I have put in console statements before and after the window.open, so I know the code is at least being executed.
My config.xml should be wide open for white listed sites:
<access origin=".*"/>;
I have tested on a Nexus 7 (android 4.2) and an android 2.2 emulator with the same results on both.
Does anyone know why window.open would not be firing correctly on android?
It looked like it was a problem with 2.6 loading plugins on Android. I upgraded to 2.7 and everything started to work.
Perhaps it's a solution to use the ChildBrowser plugin? This gives you a bit more control over the operation itself, while still preserving platform compatibility between iOS and Android.
In most cases, I use something like the following snippet to use the childbrowser to display an external page.
function openBrowser(url) {
// determine if the childbrowser plugin is available
var useChildBrowser = ('plugins' in window && window.plugins.childBrowser);
if (useChildBrowser) {
popup = window.plugins.childBrowser;
popup.showWebPage(url, { showLocationBar: false, showAddress: false });
} else {
popup = window.open(url, 'Share', "['width=600px', 'height=400px', 'resizable=0', 'fullscreen=yes']");
}
}
Note that this falls back to using window.open if the ChildBrowser plugin isn't available, so you won't break anything else with this. Could be worth a shot, perhaps?
I am using AngularJS with Trigger.io to develop a mobile application for both iOS and Android.
When I try to open a link that looks like this:
<a ng-href="#/offers/{{featured_offer.Id}}"></a>
It works perfectly fine on iOS, but on Android I get this message in the trigger console, and the link is not navigated to:
[WARNING] Attempted to open a URL which could not be handled: unsafe:content://io.trigger.forge722b6464a0e211e2ba9d12313d00dc45/src/index.html#/offers/8
How can I get this to work in Android the same as it works in iOS?
Looks like Angular adds unsafe: to url schemes it doesn't recognise, I think you want to include something like:
app.config(function($compileProvider){
$compileProvider.urlSanitizationWhitelist(/^\s*(https?|ftp|mailto|file|tel|content):/);
});
Which adds content: to the accepted url schemes.
I had this same problem, specifically with trying to display an img with a src of a file returned by forge.file.getImage. Angular adds unsafe: to the content: prefix of the local img URL, and as connorhd said, you need to add content: to the url whitelist.
Note that compileProvider's API has changed with recent versions of Angular, so I'm commenting here in case anyone else finds an updated version of this workaround useful.
app.config(['$compileProvider',
function($compileProvider) {
$compileProvider.imgSrcSanitizationWhitelist(/^\s*(https?|ftp|mailto|file|tel|content|blob):|data:image|/);
// note: you'll also have to do imgSrcSanitizationWhitelist if you want to use general links as well as ng-src on images.
}]);
I too had this problem just add sanitizer in you config.xml
var app = angular.module( 'myApp', [] )
.config( [
'$compileProvider',
function( $compileProvider )
{
$compileProvider.aHrefSanitizationWhitelist(/^\s*(https?|ftp|mailto|chrome-extension):/);
// Angular before v1.2 uses $compileProvider.urlSanitizationWhitelist(...)
}
]);
i'm trying to do a fallback on a timeout event!
ive set super.setingeterproperty("loadurltimeoutvalue", 60") so i can simulate it. Been searching around and havent found alot of answers to this.
I'm trying to do this: if timeout event -> load page from assets folder.
this so i can hide the error message that occurs on timeout. that error message contains the address to the site being loaded, and i dont want that at all to show up anywhere.
if (mWebView.loadUrlTimeout == currentLoadUrlTimeout) {
//super.loadurl("android_assets bla bla")
}
Found that code here, but cant get it to work. i think there are lots of parts missing, to the code, as i tried stripping it.
I am still pretty fresh to this, so there might be really logical flaws which i just dont see.
Any help greatly appreciated :)
Try setting following property in the activity before loading the page, it should work:
super.setStringProperty("errorUrl", "file:///android_asset/www/error_page.html");
setStringProperty has been deprecated in 3.0. Use config.xml instead:
<preference name="ErrorUrl" value="myErrorPage.html"/>
I wanna use medialets ad in my android app. I have faced some issues which are listed below,
Got an sample with downloaded sdk, banner ads are not working in the sample itself, can anyone got this issue, whats wrong with the banner ads?
And Interstitial ads are working fine with the normal activity which extends AdActivity. If I load the following lines in oncreate then its getting crashed.
InterstitialAdView view = new InterstitialAdView(AdDemo.this);
view.setSlotName("ViewTwoFull");
view.prepare();
If I give that inside onclick() then its working fine.
Actually I want to load the interstitial ads when an item clicked in the list, my list activity is there with in the tab activity, in this case interstitial ad also not coming.
Can anyone worked with medialets, how to solve these issues.
Thanks in advance.
I am the Lead Integration Engineer at Medialets. Please email help#medialets.com with the name of the App you are working on, the SDK version, and the issues you are having. We will get back to you with help as soon as possible.
Thanks,
Chris
# Ashok : uset these two lines in ur oncreate method
getAdManager().setServiceListener(this);
getAdManager().start(getParent());