I have included desktop notification in my project. Along with notification an icon should be displayed. My code seems to be correct.But the icon is not displayed in the notification.
if i am adding the complete URL like 'www.site.com/image/not.png' it may display in chrome , but not in firefox .
Here is the code
var options = {
body: 'Test Notification',
icon: "not.png",
dir : "ltr"
};
How can I get the icon to display properly within the notification?
Related
I have added a navigator.share function to my react app, but for some reason, it is only sharing the text from the object and not the URL? Is there something I am missing here?
function shareList() {
if (navigator.canShare) {
navigator.share({
title: "Page Title",
text: "brief description",
url: window.location.href,
});
} else {
//functionality for desktop
}
}
<input type="button" value="Share..." onclick="shareList()"/>
On iOS, the share dialogue pops up properly, but the share object is just text and not a URL. Here is a screenshot of the pop-up
Share dialogue screenshot
It appears the issue was with my device. I tested on another device soon after posting and it worked fine, and after restarting my device it worked as intended.
I'm trying to make a simple Firefox extension that lists topSites() in an HTML page which will act as newtab page.
var gettingTopSites = browser.topSites.get({includeFavicon: true});
gettingTopSites.then((res) => {
console.log(res[0]);
})
// The output of log:
/**
Object { type: "url", url: "https://www.facebook.com/", title: "Facebook", favicon: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAA4klEQVRYhWNwytnk6ZS+5bFT+qb/9MVbHjvlbPJkGBjLEY5gGDjLIXjUATR3gEvmZvo6wCd/2/8l2279v3zn7f+PX37+//////8/f//9f/3+O+0dUNh77P/bjz/+4wI0dYBP/rb/r959x2k5zR2wdPttvJbT3AFnr79GsezD55//Kyad+O+Rs5U+ifD1e9Tgr51+iih9VHMAOnAlkP1o7gBi9Y06gGwHkApevPk2sA44dfXVwDpg7d57A+uACUsvDbNEOOqAUQeMOmDUAVR0AHU6p+Q5YMtjBmp1z0l3AKR7DgApZF4e3+fcXwAAAABJRU5ErkJggg==" }
*/
As the above example, using topSites.get() method, I just able to get Favicons, but I need to get thumb image of the site too. The thumb images that looks like the default Firefox home page topsites. I could not able to find any option that gets the thumb image. Is there another javascript api that may get site thumb?
There is a request bug for the feature: 1246693 - Provide WebExtension Thumbnail API but it is still "open".
Currently Firefox doesn't provide any API to access thumbnail stored by Firefox itself. Instead you need to create them by yourself with HTML canvas.
I am using this library "smart-app-banner": "^2.0.0", to show the smart app banner, which it works fine, but the problem I have is this.
I have created an android app with a webview which points to my site, the thing is that the smart app banner still shows into the webview, which it does not make any sense to send the user to download the app as he already using the app.
How can I hide it from webview and only show on my site when they visit the site from a mobile device.
Currently I use this peace of code:
<script src="assets/js/smart-app-banner.js"></script>
<script type="text/javascript">
new SmartBanner({
daysHidden: 15, // days to hide banner after close button is clicked (defaults to 15)
daysReminder: 90, // days to hide banner after "VIEW" button is clicked (defaults to 90)
appStoreLanguage: 'us', // language code for the App Store (defaults to user's browser language)
title: 'Winnova',
author: 'Starcut LLC',
button: 'VIEW',
store: {
ios: 'On the App Store',
android: 'In Google Play',
windows: 'In Windows store'
},
price: {
ios: 'FREE',
android: 'FREE',
windows: 'FREE'
}
// , theme: '' // put platform type ('ios', 'android', etc.) here to force single theme on all device
// , icon: '' // full path to icon image if not using website icon image
// , force: 'ios' // Uncomment for platform emulation
});
</script>
You can set a custom User Agent in the WebView settings and use this in your web application.
webview.getSettings().setUserAgentString("my-android-app");
Then in your web application you can do something like this:
<script>
if (navigator.userAgent !== 'my-android-app') {
new SmartBanner({
...
})
}
</script>
Be aware though, if you use web Analytics I wouldn't change the User Agent.
I'm working with desktop notifications everything works fine here is the code I'm using:
function notifyMe(title,icon,body,tag) {
var notification = new Notification(title, {
icon: icon,
body: body,
tag: tag
});
setTimeout(function(){
notification.close();
},6000);
}
Now what I want is how I can close the notification without showing a notification for example if a notification is appearing , how can I close it from another function or something like that. because I want to work with pagevisibility when tab is hidden it will show notification and when tab is visible I want to hide the notification.
I am developing an app for Android which should have the functionality to take a picture, and share it to the Instagram app.
The app opens up the camera, takes a picture and then the Instagram app is opened with the "Crop photo" window active. It seems to be loading the picture, but after a couple of seconds the app crashes, i can't see that the image ever gets loaded.
I am developing the app on top of Appcelerators Titanium platform, however i do not think that my problem is related to Titanium, but rather how i pass the image.
Since the emulator doesn't have the Instagram app, i am developing on my Galaxy S4. I have tried running logcat through adb to get some sort of error message to help me, but only thing i see is that it notices that Instagram exited.
Here is my code, what could be wrong? I have checked that the image is saved into the filesystem.
Ti.Media.showCamera({
success: function(event) {
var file = Ti.Filesystem.getFile(Ti.Filesystem.tempDirectory,"ggs-instagram.jpg");
file.write(event.media);
var instaIntent = Ti.Android.createIntent({
action: Ti.Android.ACTION_SEND,
packageName: "com.instagram.android",
type: 'image/jpeg'
});
/*instaIntent.putExtra(Ti.Android.EXTRA_TEXT, "EXTRA_TEXT");
instaIntent.putExtra(Ti.Android.EXTRA_SUBJECT, "EXTRA_SUBJECT");*/
instaIntent.putExtra(Ti.Android.EXTRA_STREAM, file.getNativePath());
Ti.Android.currentActivity.startActivity(instaIntent);
},
cancel: function() {},
error: function (error) {
if (error.code == Ti.Media.NO_CAMERA) {
alert("Din telefon/platta har ingen kamera!");
} else {
alert("Kamerafel!");
}
},
mediaTypes: [Ti.Media.MEDIA_TYPE_VIDEO,Ti.Media.MEDIA_TYPE_PHOTO],
showControls: false,
autohide: false,
saveToPhotoGallery: true
});
pls take a look at
Instagram from Android open on certain user and add caption to uploaded image
Instagram Option in Sharing Intent Android
Android: post image and text to Instagram