Suggest some working examples for android titanium Twitter integration.
I already tried some sample like Birdhouse, Social java script file but with that i didn't get the required output.
i just want to post a text through my titanium android app into twitter. May I know what is the correct way to achieve my objective?
Thanks in advance
Use social_plus.js it works for both android and iOS
https://github.com/aaronksaunders/test_social
Thanks
My Problem Get Solved by the Below Code
var social = require('alloy/social').create({
consumerSecret: 'consumer-secret',
consumerKey: 'consumer-key'
});
// If not authorized, get authorization from the user
if(!social.isAuthorized()) {
social.authorize();
}
// Post a message
// Setup both callbacks for confirmation
social.share({
message: "Salut, Monde!",
success: function(e) {alert('Success!')},
error: function(e) {alert('Error!')}
});
// Deauthorize the application
social.deauthorize();
Why don't you create a intent share menu ? It allows users to send content on all installed
apps that are able to share content. (email, sms, hangout, facebook...and twitter)
var createShareMenu = function(){
var subject = 'My subject';
var text = 'My text';
var intent = Ti.Android.createIntent({
action: Ti.Android.ACTION_SEND,
type: "text/plain",
});
intent.putExtra(Ti.Android.EXTRA_TEXT,text);
intent.putExtra(Ti.Android.EXTRA_SUBJECT,subject);
var share = Ti.Android.createIntentChooser(intent,'Share');
return share;
};
and to show the share apps menu :
shareButton.addEventListener('click', function() {
var share = createShareMenu();
var activity = win.getActivity();
activity.startActivity(share);
});
Related
I need to be able to open the default email app on the click of a button from a react native application. I tried using react-native-email-link but it does not have the option of adding attachments. Is there something else I can use that will allow attachments?
You can likely achieve this with expo-mail-composer:
import * as MailComposer from 'expo-mail-composer';
[...]
const canMail = await MailComposer.isAvailableAsync();
if(!canMail) {
console.warn("Can't open the mail app! You may be using the iPhone simulator or don't have a mail app installed")
return;
}
MailComposer.composeAsync({
subject: "Hello, Mail Composer!",
body: "Some body text goes here",
recipients: "somebody#example.com",
attachments: [
"https://venturebeat.com/wp-content/uploads/2017/09/stack_overflow_logo.jpg?w=1200&strip=all"
// you can also attach local files
]
});
Working Snack demo here: https://snack.expo.dev/#joem-rp/expo-mail-composer-demo
Click here to view screenshot here
I am using react native app auth with Azure active directory and in android after redirecting back to the app, two apps are shown (like in the above screenshot) , if i select the correct app the app works as expected, but if i select the other, the app crashes. How can i fix this issue and show only one app!
const config = {
issuer: 'https://login.microsoftonline.com/your-tenant-id',
clientId: 'your-client-id',
redirectUrl: 'urn:ietf:wg:oauth:2.0:oob',
scopes: [], // ignored by Azure AD
additionalParameters: {
resource: 'your-resource'
}
};
// Log in to get an authentication token
const authState = await authorize(config);
// Refresh token
const refreshedState = await refresh(config, {
refreshToken: authState.refreshToken,
});
Try not to put "scheme" option into app.json and use a redirectUrl like this.
<your.package.identifier>://oauthredirect
According to this AppAuth OAuthRedirect, AppAuth uses for scheme the android.package identifier. For example if your package.identifier is "your.company.app", use a redirectUrl like this: your.company.app://oauthredirect. It works for me.
I am trying to share image particularly in WeChat and WhatsApp by using this plugin : EddyVerbruggen/SocialSharing-PhoneGap-Plugin
window.plugins.socialsharing.shareVia('whatsapp','msg',null,
'images/hello.png' , null /* url */, function(e) {
console.log('share' +e)
}, function(errormsg){
alert(errormsg)
})
window.plugins.socialsharing.shareVia('com.tencent.mm','msg',null,
'images/hello.png' , null /* url */, function(e) {
console.log('share' +e)
}, function(errormsg){
alert(errormsg)
})
My app gets crashed in ios but in android it works fine.
by using another method shareViaWhatsapp:
window.plugins.socialsharing.shareViaWhatsApp('Message via WhatsApp'
,'images/hello.png', function() {
console.log('share ok')
}, function(errormsg){
alert(errormsg)
})
This method working in android but in ios its showing all the apps to share when i share image, If i share only message its working properly in ios. Please guide me.
Sharing to whatsApp with shareViaWhatsApp is not working on iOs also in my case I can confirm.
Only way I was able to share picture was using share sheet with the plugin you mentioned.
So its something like:
this.socialSharing.share(null, null, this.screen, null).then(() => {
console.log(' succ share test')
this.shareWhatsApp()
}).catch((e) => {
console.log(' err share test')
this.shareWhatsApp()
});
I am trying to implement Facebook app invite with this plugin in my ionic application. The implemented codes are following as below:
$scope.appInviteToFriend = function(user){
var url = "";
if (ionic.Platform.isAndroid())
{
url = "https://play.google.com/store/apps/details?id=com.example.application";
}
else if (ionic.Platform.isIOS())
{
url = "https://itunes.apple.com/nl/app/example-by-ionicapplication/id1983838444?l=en&mt=8";
}
var option = {
url: url,
picture : ""
};
facebookConnectPlugin.appInvite(
option,
function(obj){
if(obj) {
if(obj.completionGesture == "cancel") {
// user canceled, bad guy
} else {
// user really invited someone :)
}
} else {
// user just pressed done, bad guy
}
},
function(obj){
// error
console.log(obj);
}
);
}
When I executed these codes, the Facebook Invite Dialog opens and displayed app information correctly. But after click next button, select friend and also click send button, The error occurs. It says "Missing App Link URL. The app link used with this invite does not contain an Android or iOS URL.Developers are required to enter URl for at least one platform.". I've attached the error details with part of screenshot. Are these wrong the URLs which are store URL? How can I set the URLs?
You need to provide an App Link instead of a web URL. This link can be statically generated using Facebook's own tools, or you can generate them dynamically server-side. You can read more about these in the documentation.
Here's a tutorial that walks through setting up an Android app.
We are trying to implement a simple solution to our website developed via Flex and mobile apps developed using Adobe Air.
1) Our users would like to import their facebook friends onto website via www.ourwebsite.com and also via the Ourwebsite android, ios & blackberry apps.
2) We want to use the Facebook Requests dialog which allows users to select their friends and send multiple invitations at a time
3) When the recepient clicks on the notification he receives
in case of web, it should direct the notification recipient to www.ourwebsite.com
in case of mobile app, it should re-direct to respective appstore to download our app.
We tried several configurations but it's not working for us.
As previously said we have developed our website using Adobe Flex and our Mobiles apps run using Adobe Air. Do we need to install the Facebook native SDK's into our code?
Strangely the exact same requirement is working for www.naaptol.com and 9lessons.info.
But we're unable to achieve the same technique.
Can anyone guide us or advise if we're missing any important aspect of Facebook App & its policies.
Thank you.
Sai Krishna
So if I think I am understanding this right, you want to be able to open a link differently based upon the platform they are on. Here is some js that will do it for ios and android. If they have your app installed it will launch the app, otherwise it will send them to the app store
// if iPod / iPhone, display install app prompt
if (navigator.userAgent.match(/(iPhone|iPod|iPad);?/i) || navigator.userAgent.match(/android/i)) {
var store_loc = "itms://itunes.com/apps/youriOSApp";
var href = "yourPrefix://";
var is_android = false;
if (navigator.userAgent.match(/android/i)) {
store_loc = "https://play.google.com/store/apps/details?id=air.com.your.app";
is_android = true;
}
var app_loc = href;
if (is_android) {
var w = null;
try {
w = window.open(app_loc, '_blank');
} catch (e) {
// no exception
}
if (w) {
window.close();
} else {
window.location = store_loc;
}
} else {
var timeout = null;
window.location.replace(app_loc);
timeout = setTimeout(function () {
"use strict";
window.location = store_loc;
}, 300);
onblur = function () {
"use strict";
clearTimeout(timeout);
};
}
}