How can u get my webworks app to pop open the blackberry 10 share panel?
Ex: open a website in the browser, click the overflow button and then click share
Thank you!
You'll want to look at the invokeTargetPicker API.
Essentially, you create a request
var request = {
action: 'bb.action.SHARE',
// for a file
uri: 'file://' + path,
// for text you'd use 'data'
data: 'I am awesome',
target_type: ["APPLICATION", "VIEWER", "CARD"]
};
Then you call the API
blackberry.invoke.card.invokeTargetPicker(request, "Your Title",
// success callback
function() {
console.log('success');
},
// error callback
function(e) {
console.log('error: ' + e);
}
);
API Documentation is available here: https://developer.blackberry.com/html5/apis/blackberry.invoke.card.html#.invokeTargetPicker
I wrote a sample app, which you can test out on our GitHub repo: https://github.com/ctetreault/BB10-WebWorks-Samples/tree/master/ShareTargets
This should be an option that appears on any link, image or Text: "Share". Is the item not present in the Cross Cut menu shown?
Related
I'm developing an ionic project.
I have follwed all steps to installa Social Sharing and Deeplinks.
This is my schema when I install plugin.
ionic cordova plugin add ionic-plugin-deeplinks --variable URL_SCHEME=app --variable DEEPLINK_SCHEME=https --variable DEEPLINK_HOST=app.com --variable ANDROID_PATH_PREFIX=/
But when I share with Social Sharing don't send a url, Social Sharing send as string or via email send some structure as string an other part as url.
e.g. via hangout as string
e.g. via email app://app.com/page --> app:// as string and app.com/page as url
In Social share documentation schema is share(meesage, subject, file, url)
message:string, subject:string, file:string|Array, url:string
this.socialSharing.share('Lorem ipsum', 'title', null, 'app://app.com/about')
.then( ()=> {
console.log('Success');
})
.catch( (error)=> {
console.log('Error: ', error);
});
The app open deeplinks when I tested using browser from codepen.io with hiperlink.
< h1 >< a href="app://app.com/about" >Click Me< /a>< /h1>
But when I share a deeplink send as string.
Why??? Can you help me???
I struggled with the same problem, the solution to this is very straight forward:
Do not use custom url schemes
The main reason for not using custom url schemes is that Gmail and other webmail provider indeed destroys links such as "app://...". So there is no way to get this work.
See the following links for details:
Make a link in the Android browser start up my app?
https://github.com/EddyVerbruggen/Custom-URL-scheme/issues/81
Use universal links instead
Universal links is supported by Android und iOS. Since you are already using the ionic-plugin-deeplinks plugin, you already configured a deeplink url.
All you have to do is change
href="app://app.com/about"
to
href="https://app.com/about"
For using universal links you need to create configuration files for android and iOS. These files must include application identifiers for all the apps with which the site wants to share credentials. See the following link for details:
https://medium.com/#ageitgey/everything-you-need-to-know-about-implementing-ios-and-android-mobile-deep-linking-f4348b265b49
The file has to be located on your website at exactly
https://www.example.com/.well-known/apple-app-site-association (for iOS)
https://www.example.com/.well-known/assetlinks.json (for android)
You can also use to get data from custom URL and deep link in our app if exist. Otherwise, redirect to play/app store like this:
index.html
$(document).ready(function (){
var lifestoryId = getParameterByName('lifestoryId');
if(navigator.userAgent.toLowerCase().indexOf("android") > -1){
setTimeout(function () {
window.location.href = "http://play.google.com/store/apps/details?id=com.android.xyz&hl=en";
}, 5000);
}
if(navigator.userAgent.toLowerCase().indexOf("iphone") > -1){
setTimeout(function () {
window.location.href = "https://itunes.apple.com/us/app/app/id12345678?ls=1&mt=8";
}, 5000);
}
window.location.href = "app://lifestory/info:"+lifestoryId;
});
function getParameterByName(name, url) {
if (!url) url = window.location.href;
name = name.replace(/[\[\]]/g, "\\$&");
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
results = regex.exec(url);
if (!results) return null;
if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/\+/g, " "));
}
Call link like: BASE_URL/index.html?lifestoryId=123
We have used Branch.io for implementing deep links in our mobile hybrid app which is developed using ionic 1 framework. We have used branch-cordova-sdk plugin and configured the deep links for sharing with social media apps. We are passing title, description and contentImageUrl for branch.io to create the link. It works great on almost all SM platforms except Snapchat.
When the content is shared on snapchat, the link is showing up along with content but it is not clickable from snapchat. There is no preview of the image is shown. I could not find any solution for this yet. Also please see the code down below in reply. thanks.
Here is the code i'm using:
var branchUniversalObj = null;
var props = {};
props.canonicalIdentifier = 100;
props.title = "my title";
props.contentDescription = "my description";
props.contentImageUrl = "http://lorempixel.com/400/400/";
//create branch object
Branch.createBranchUniversalObject(props).then(function (res) {
branchUniversalObj = res
console.log('Response: ' + JSON.stringify(res))
}).catch(function (err) {
console.log('Error: ' + JSON.stringify(err))
});
Somewhere in the code:
var analytics = {
campaign: "sharing cards"
}
var properties = {
cardId : 100,
cardType: "promo",
refUser: "John"
}
// share sheet
branchUniversalObj.showShareSheet(analytics, properties, "Hello awesome stuff");
When you share a Branch link on various Social Media platforms, it is scraped to display the OG related information (i.e. OG Title, OG Image and OG Description).
When scraped, Branch will return: 1st: any OG parameters that have been defined for the link; 2nd: any OG parameters that have not been defined for the link but that have been defined at the app level (in Social Media Display Customization on the Link Settings page); and finally: any meta tags present on the web site specified in the Default URL ($fallback_url) page.
In order, to ensure that the OG image is displayed correctly, you need to ensure that you have the OG parameters defined at atleast one of the three levels mentioned above.
Here are the various ways to set OG tags
To add the og_image for a particular Quick link on the dashboard:
Visit the Quick links page on your dashboard.
Click on 'Create new Link'
On the 'Configure Options' tab and 'Social Media' section either add the og_image or the og_image_url.
While creating links from the iconic SDK add image URL to the Branch Universal Object using contentImageURL tag as shown below:
Code snippet
var properties = {
canonicalIdentifier: 'content/123',
canonicalUrl: 'https://example.com/content/123',
title: 'Content 123 Title',
contentDescription: 'Content 123 Description ' + Date.now(),
contentImageUrl: 'http://lorempixel.com/400/400/',
price: 12.12,
currency: 'GBD',
contentIndexingMode: 'private',
contentMetadata: {
custom: 'data',
testing: 123,
this_is: true
}
}
// create a branchUniversalObj variable to reference with other Branch methods
var branchUniversalObj = null
Branch.createBranchUniversalObject(properties).then(function (res) {
branchUniversalObj = res
alert('Response: ' + JSON.stringify(res))
}).catch(function (err) {
alert('Error: ' + JSON.stringify(err))
})
To set these OG tags by default for your branch links:
Go to the Link Settings Page on your dashboard:
Scroll down to the "Social Media Display Customization" section
Set the Link Title, Description and an image. Here is a screen shot for your reference.
PS: As a final caution, make sure the image you specify as the OG Image adheres to the Snapchat accepted image dimesions, which I belive is 1080 x 1920 pixels.
i am just trying to implement facebook and twitter in my Webworks App and cannot get them work together.
I am using the FaceBook-OAuth-2 and the Twitter-OAuth-1 sample and i just put both stuff together and my problem is that only the first startOAuth() opens a window in the app to login the second doesn't so if i first clicked facebook it works after when i try twitter nothing happens.
https://github.com/blackberry/BB10-WebWorks-Samples
thanks
function setClickHandlers() {
console.log('set click handlers');
var fb = document.getElementById('facebookOn');
fb.addEventListener('click', function(e) {
// if the childWindow is already open, don't allow user to click the button
if(childWindow !== null) {
return false;
}
e.preventDefault();
toast('Contacting Facebook...');
setTimeout(function() {
startOAuth();
}, 500);
});
console.log('set twitter click handlers');
var tw = document.getElementById('twitterOn');
tw.addEventListener('click', function(e) {
// if the childWindow is already open, don't allow user to click the button
if(childWindow !== null) {
return false;
}
e.preventDefault();
toast('Fetching access token...');
setTimeout(function() {
twittergetAccessToken();
}, 500);
});
}
I would start by adding some debug code in your click handler to see if that's getting called when you click the button in the first place.
If it is, then I recommended you use Web Inspector (console) to see if there are any errors. If there are, they'll show up there.
Good reference for Web Inspector here - http://developer.blackberry.com/html5/documentation/web_inspector_overview_1553586_11.html
If the click handler is not being fired then perhaps you have the wrong element ID, or the setClickHandlers function is not being executed.
I have been searching for facebook publishing without showing Dialogue.
While reading Facebook developers doc, there are several things which seems to answer the question but after using them, I concluded those are not for this functionality.
Display Modes: They are different type of display mode for dialogues, but there is no way to define if I don't want to show the dialogue.
Explicit Sharing: This seems to be most close. But there is no way to use it in JS SDK. And the parameter mentioned there, I tried in JS but no resolution.
Then here what came to be most successful for me, to use
methode: '/me/feed'
But the problem is, it says:
[User] shared a link
Which I don't want. I want a normal publishing, but without any dialogue to be displayed.
Code I am using for simple publishing is below:
function publishNewsFeed(picURL, name, caption, description)
{
var obj =
{
method: 'feed',
link: fbAppURL,
picture: picURL,
name: name,
caption: caption,
description: description
};
function callback(response)
{
document.getElementById('msg').innerHTML = "Post ID: " + response['post_id'];
}
FB.ui(obj, callback);
}
Any help will be appreciated.
Thanks
-WI
Display Modes: They are different type of display mode for dialogues, but there is no way to define if I don't want to show the dialogue.
That would be nonsense – if you don’t want to use a dialog, then don’t use a dialog.
But if you want to use a dialog, then it has to be “shown” in some way – otherwise it would not be a dialog.
But the problem is, it says [User] shared a link Which I don't want.
That is current “bug” – if you supply action links with your post, it will show up normal.
https://developers.facebook.com/bugs/485696594791863
Try this:
function jesseSays(){
var body = 'Yeah science Mr. White!!';
FB.api('/me/feed', 'post', {
message: body,
link: 'http://www.neoapps.com.br',
picture: 'http://www.neoapps.com.br/assets/img/logo-big.png'
}, function(response) {
if (!response || response.error) {
alert('Error occured');
} else {
alert('Post ID: ' + response.id);
}
});
}
I am needing to send a tweet for from my iphone/ipad app using Appcelerator Titanium & javascript. I found the following example on github (code also posted below for this):
https://gist.github.com/2eabc31db388144b3abc
I have created my app details (key,secret etc) in my twitter developer account and using the code from the example i get the twitter login and authorisation popup but once you click authorise, all i get is a webview showing the callback url (that i was required to put in the twitter app settings). So the app is stuck on a webview showing the callback url but does nothing after. If i close the popup window it just goes back to my app without sending a tweet.
Can anyone help?
code in app.js:
var win = Ti.UI.createWindow({ backgroundColor: '#fff' });
var shareButton = Ti.UI.createButton({
width: 90, bottom: 10, height: 30,
title: 'Tweet!"'
});
win.add(shareButton);
win.open();
var social = require('social');
var twitter = social.create({
site: 'Twitter',
consumerKey: 'XXXXXXXXXXXXXXXX',
consumerSecret: 'XXXXXXXXXXXXXXXXXXXXX'
});
shareButton.addEventListener('click', function() {
twitter.share({
message: 'Hello, world!',
success: function() {
alert('Tweeted!');
},
error: function(error) {
alert('Oh no! ' + error);
}
});
});
As Aaron answered on the Q&A, when using Social.js, you should not use a callback URL. The code itself will watch the web view for what it needs.