I have a Worklight 6.2 app. I am modifying the android java code to subscribe to a notification sent via Bluemix. After the user logs in, I would like to register the device using the userid that gets created. Is there an API call that I can use within the android code that is the equivalent to WL.Client.getUserName, or should I be calling the java code from my javascript and passing the userName to the java code? Thanks for any suggestions.
JT
There is no Java equivalent to this. This is a Worklight API.
What you can do is use the new WL.App.sendActionToNative method in Worklight 6.2 for to send a value to your native code and from there do what you need with it.
WL.App.sendActionToNative(“doSomething”, { customData: 12345} );
Where customdData is the WL.Client.getUserName.
On the native side you then need to use WLActionReciever (see What's New).
You could also opt to implement a basic Cordova plug-in that will move data from the web to native view.
The tutorial in the Getting Started page is doing exactly that.
Related
I'm trying to invoke one AWS Lambda function from my Android application.
If I understand correctly, I have to start with something like this:
BasicAWSCredentials creds = new BasicAWSCredentials(keyId, secret);
AWSLambdaClientBuilder builder = AWSLambdaClientBuilder.standard()
.withCredentials(new AWSStaticCredentialsProvider(creds))
.withRegion(regionName);
AWSLambda lambdaClient = builder.build();
and then the rest of the code with InvokeRequest etc.
Problem is in the above code, after it app crashes. I can't find the correct set of libs to make this work in Android.
If I use
implementation 'com.amazonaws:aws-java-sdk-lambda:1.11.782'
then it compiles fine and executes up to the "builder.build()" and then crashes and if I use
implementation 'com.amazonaws:aws-android-sdk-lambda:2.16.12'
(which is supposed to be used for Android???) Then "import com.amazonaws.services.lambda.AWSLambdaClientBuilder;" is red cause there's no such thing in the lib..
I get that AWSLambdaClient is deprecated and AWSLambda should be used, then what about AWSLambdaClientBuilder? What should I use?
Basically, if everything above is wrong, how do I get to call AWS Lambda function (by the way, this is without using API Gateway) from an Android app? What libs (with versions) would work for it?
I tried to follow https://docs.aws.amazon.com/lambda/latest/dg/with-android-example.html tutorial, but they also have deprecated stuff, plus it wants to involve Cognito and I was under the impression that I could call a function directly with a key and secret of a user with specific policy..
A different approach, but you can use the API gateway or application load balancer and call the configured endpoint from the android application.
Benefit with this, you will not need to configure the application to have the client id, and client secret set up, and even if restart, it would be simple api gateway call.
Lambda can work with both API Gateway as well as Application Load Balancer, and it is pretty easy to configure. Refer this page for details on ALB with Lambda.
I'm creating a flutter plugin that uses a 3rd party SDK
The SDK has an override method called onIdleTimeout(), when this method fires the SDK logs the users out, and pulls up a native login view.
I don't want this native login view to pop up, so when this onIdleTimeout() fires I want to send a message back to the Flutter dart code that is using my plugin to simply let it know that the onIdleTimeout() method has fired
I've looked at examples of using EventChannels but none of them show using event channels inside of an custom override method in native code
any help is much appreciated thank you, I'm starting with the Android/Kotlin side of the plugin so any kotlin examples would be great
Found out I can just use a BasicMessageChannel to send a message from native to dart
As we know, there have been changes in access to the twitter API referring to callbacks URLs.
So far, I have been using the identification callback with firebase, as I indicated here:
This has been working perfectly so far.
I read in the documentation that now you have to indicate the callback, according to android or iOS in the following way:
twitterkit- : // if using Twitter Kit for iOS or
twittersdk: // if using Twitter Kit for Android.
My application is only developed for android.
I have tried all the possible variants, but I always get the following error:
The client application failed validation: Not a valid callback URL format.
The tested options have been:
twittersdk://pfa89MGYola62VIln ........ (MY_CONSUMER_KEY)
twittersdk://MY_APP-android.firebaseapp.com/__/auth/handler
twittersdk://https://MY_APP-android.firebaseapp.com/__/auth/handler
I have activated and deactivated the check "enable callback locking" ...
I've tried everything, I'm a little desperate
For another test, I tried to register the URL callback as if it were the iOS platform
twitterkit-MY_CONSUMER_KEY://
and it was accepted on the first attempt.
I do not mind losing the relationship with firebase, the truth is that I was not using it, but I have a serious problem if I can not connect with twitter again.
I appreciate any help.
I found the solution, I put it here in case it can be of help to someone.
The truth is that it is not well specified in the documentation, you have to take two steps.
First: activate the "enable callback locking" checkbox
Second: indicate the android sdk for twitter, WITHOUT CONSUMER KEY, unlike iOS users.
It would be like this:
I hope it helps
I created Android App that is made by cocos2d-x.
I'd like to implement cooperation function with social network service (facebook and twitter )
For example, Like! button which separate news feed.tweet function.
But This function turned out to be a can of worms which I couldn't finish.
I found EziSocial. but I can't find any hints.
would you give me a
description of how to use and method of attach to existing app
We have series of tutorials available on our website. http://ezibyte.com/tutorials/
Disclaimer: I am the creator of EziSocial Plugin
So I have been trying to run the Facebook Connect example for PhoneGap / Android with no luck.
https://github.com/davejohnson/phonegap-plugin-facebook-connect *
There are some similar threads with the same problem.. conclusion is that "Facebook SDK is a moving point"
I have succesfully compiled previously apps using phoneGap & Eclipse.
Now following the example* for Android. If I do exactly what they suggest. App shows the buttons but nothing happens when I click on them.
After analyzing the code I have noticed that
function initFB(){
try {
FB.init({ appId: "45253452345234523", nativeInterface: PG.FB });
document.getElementById('data').innerHTML = "";
} catch (e) {
alert(e);
}
}
there is a parameter nativeInterface : PG.FB which is nowhere described within Facebook API for this call..
http://developers.facebook.com/docs/reference/javascript/FB.init/
what is more interesting is that when i remove this parameter.. suddenly Login button goes to Facebook page with Error Code API 191.
So my question is what this parameter is supposed to do? and why it is not in Facebook API?
I have found no info about this parameter in internet. I guess if it would be a case of an out-dated FB API there would be some info available.
Any ideas?
Thanks,
Marcin
The "nativeInterface: PG.FB" option is to tell PhoneGap to use the native authentication interface instead of the mobile web interface. If you don't add in the "PG.FB" option, you'll get redirected to Facebook's mobile authentication instead. It took me a while to figure this out too, and it's not well documented, but that's what is going on.
Two other things about the PhoneGap Facebook Plugin that are not up to date with the latest Facebook JavaScript SDK:
When using FB.login() you should be using the "scope" parameter, but PhoneGap expects the deprecated "perms" parameter.
When the authentication response from FB.login() you should be getting "response.authResponse", but instead "response.session" is what is given back. This means you'll have to pull out the OAuth Access token with "response.session.auth_token" instead of "response.authResponse.accessToken".
Hopefully they'll get to updating the PhoneGap Facebook Plugin, but for now I use if/else statements to detect if PhoneGap is there. You can check if PhoneGap is initialized by using:
if(window.PhoneGap) {
//PhoneGap Library is Loaded
}