Android Picasso Library - retrofit

I used Picasso for loading custom image from api. but not working picasso image loader. Picasso place on RecyclerView.Adapter. retrofit used for json client. pls Explain.
if ( !(partnerChallenge.get(position).getImage().equalsIgnoreCase("null"))) {
String url = partnerChallenge.get(position).getImage();
Log.e("mDailyChallenge", url);
String uu = "http://dev.e.lk/v2/badges_image/level1_v2.png";
Picasso.with(context).load(url)..into(holder.iv_home_badge);
}
I used above url variable to picasso but image is not loading. then i used uu variable to picasso it workig well.
This is my Logcat result
E/mDailyChallenge: http://dev.goyo.lk/v2/badges_image/level1_v2.png

i think you are using an Old Version of Picasso Library. You will face many problem esp. devices running on newer Version of Android. I suggest you update your library.
Gradle file add:
implementation 'com.squareup.picasso:picasso:2.71828'
Java
Picasso.get().load(URL.here).into(imageView1);
Picasso.get().load(R.drawable.landing_screen).into(imageView1);
Picasso.get().load("file:///android_asset/DvpvklR.png").into(imageView2);
Picasso.get().load(new File(...)).into(imageView3);
Picasso more details here

Related

Firebase dynamic link is not resolving in Xamarin Forms iOS

I am using Xamarin.Firebase.iOS.DynamicLinks 2.3.1.1 for dynamic links, Earlier it was working fine but recently it is not working. While trying to extract the short link, long link getting null. Is anyone knows why it is not working?
I have updated to the latest version (4.0.1) and its working fine. It not working any of the previous version of NuGet packages.
To answer your question. The Dynamic links are not working either on Firebase's end who choose to discontinue their old library or due to the newest IOS update 13.3. I say this because my app that is in production had its links working fine then they suddenly stopped working.
My current solution was to update Xamarin.Firebase.iOS.DynamicLinks to (4.0.1) and I was able to once again process the long url with its parameters.
A few things to note if you have other libraries such as Firestore, Analytics, Notifications etc.
You might run into linker failed exceptions. They occur because
Xamarin.Firebase.iOS.DynamicLinks (3.0.2.1) and prior depended on
Xamarin.Firebase.iOS.Core (>= 5.1.3) and the working
Xamarin.Firebase.iOS.DynamicLinks (4.0.1.1) references
Xamarin.Firebase.iOS.Core (>= 6.1.0.1) Somehow they reference methods that are no longer available.
The linking failed is fixed by checking each of your nuGets and manually installing their respective nuGets that reference ...iOS.Core (>= 6.1.0.1) : For example:
if you use Xamarin.Firebase.iOS.Storage (2.0.0) manually install
Xamarin.Firebase.iOS.Storage (3.4.0.1) because
Xamarin.Firebase.iOS.Storage (2.0.0) references
Xamarin.Firebase.iOS.Storage (>= 3.0.2) which in turn references:
Xamarin.Firebase.iOS.Core (>= 5.1.3) and it will cause native linking failed
And lastly, in my case Xamarin.Firebase.iOS.DynamicLinks (4.0.1.1) will make your method for generating ShortLinks, stop working too:
In Xamarin.Firebase.iOS.DynamicLinks (3.0.2.1) you would build your
DynamicLinkComponents with:
var shareLink = DynamicLinkComponents.FromLink(linkParameters,
"YOUR_DOMAIN.page.link");
Xamarin.Firebase.iOS.DynamicLinks (4.0.1.1) recomends you use
DynamicLinkComponents.Create(YOURlinkParameters, "YOUR_DOMAIN.page.link");
but it would return a null DynamicLinkComponents so i fixed by doing:
var shareLink = new DynamicLinkComponents();
shareLink.Link = YOURlinkParameters;
shareLink.Domain = "https://YOUR_DOMAIN.page.link";
I spent a week trying to troubleshoot this error and really hope others are able to see this and save you valuable time.
A work around to get Xamarin.Firebase.iOS.DynamicLinks 3.0.2.1 working (should work on 2.3.1.1 as well) is to have the IOS device open the link in the browser which will then redirect them back to the app.
The flow is Dynamic link > App [short link] > Browser > App with [long link].
Dynamic links are formatted "domain.page.link/ShortSequence" and long links parameters have "domain.page.link/?". You can look for the '?' to decide weather to process url or to redirect user as follows:
public override bool ContinueUserActivity(UIApplication application,
NSUserActivity userActivity, UIApplicationRestorationHandler completionHandler)
{
if (userActivity.ActivityType == NSUserActivityType.BrowsingWeb)
{
var sharedLink = userActivity.WebPageUrl;
if (!sharedLink.ToString().Contains("domain.page.link/?")){
await Launcher.OpenAsync(new Uri(sharedLink.ToString()));
return;
}
var handled = DynamicLinks.SharedInstance.FromUniversalLinkUrl(sharedLink);
//Process your DynamicLink parameters
}
return true;
}

Unity 5.6: Google Play Services and Firebase Messaging plugins not compatible

I'm cannot make a build after installing both the Google Play Services plugin and the Firebase Messaging plugin. I'm using the latest versions of both. I get the "Unable to convert classes into dex format" error. The two libraries that conflict are play-services-auth-10.2.6 and play-services-base-11.2.0. Google Play Services resolver grabs these two libraries for me. Anyone have a solution?
I've been messing around with the GPGSDependencies.xml and the PluginVersion.cs file from the google play services plugin. I was attempting to make the library versions identical.
I did manage to get identical library versions, this did solve the DEX format issue, but when I made a call for authenticating a google account my app crashed.
This is what I did:
In GPGSDependencies.xml I changed the 10+ in these lines to 11.1+
<androidPackage spec="com.google.android.gms:play-services-games:10+">
...
<androidPackage spec="com.google.android.gms:play-services-nearby:10+">
...
<androidPackage spec="com.google.android.gms:play-services-auth:10+">
And I also changed the lines in PluginVersion.cs to
// used to check for the correct min version or play services: 11.2
public const int MinGmsCoreVersionCode = 11200000;
// used to get the right version of dependencies.
public const string PlayServicesVersionConstraint = "11.1+";
from
// used to check for the correct min version or play services: 10.2
public const int MinGmsCoreVersionCode = 10200000;
// used to get the right version of dependencies.
public const string PlayServicesVersionConstraint = "10+";
The PluginVersion.cs alteration was mentioned here:
https://github.com/playgameservices/play-games-plugin-for-unity/issues/1892#issuecomment-325555313.
This didn't solve all my problems but maybe it will help you.
Let me know if you managed to solve it, I am still working on a solution.
I got it to work with the latest google play services resolver.
https://github.com/googlesamples/unity-jar-resolver

Where is the NavigationManager?

Where is NavigationManager? In old version, I can use NavigationManager to simulate an route, like from SF to LA.
NavigationManager navigationManager = NavigationManager.getInstance();
navigationManager.addNewInstructionEventListener(new WeakReference<>(mNewInstruction));
navigationManager.addGpsSignalListener(new WeakReference<>(mGpsSignalListener));
navigationManager.addRerouteListener(new WeakReference<>(mRerouteListener));
navigationManager.addPositionListener(new WeakReference<>(mPositionListener));
navigationManager.addSafetySpotListener(new WeakReference<>(mSafetySpotListener));
navigationManager.addLaneInfoListener(new WeakReference<>(mLaneInfoListener));
navigationManager.addRealisticViewListener(new WeakReference<>(mRealisticViewListener));
//set the map where the navigation will be performed
navigationManager.setMap(mMap);
NavigationManager.Error error=navigationManager.simulate(mapRoute.getRoute(), 50);
Could you please tell me how can I implement simulation function with your latest here android sdk?
Thanks in advance.
According to the latest documentation, these APIs have not changed: NavigationManager API Reference.
The way you include the HERE SDK library in your project has changed, however. It is now delivered as an AAR file rather than as separate jar and native library files. Are you sure you are including the HERE SDK properly and it is present in your classpath? For further info on the new steps see this tutorial.

How to call a RESTful API with ASP.NET 5

Working with ASP.NET 5 on my Mac in Visual Studio Code. I have a RESTful API I need to call and not sure exactly how to do it. I've seen many examples using WebClient, HttpClient, WebRequest and HttpWebRequest.
I think my pain point is the dnxcore50 framework. Can someone please point me in the right direction with some code samples?
Here is an example about how to call a service. Please check the References and using carefully.
One important thing you have to do is install the Web API Client Libraries package: From the Tools menu, select NuGet Package Manager, then select Package Manager Console. In the Package Manager Console window, type the following command: Install-Package Microsoft.AspNet.WebApi.Client.
For the full source code, check this link.
I'm assuming it's the same way we used to do it prior to ASP .NET 5, so first you install the ASP .NET Web API Client Libraries NuGet package.
With that available, you reference System.Net.Http:
using System.Net.Http;
Then you use it as follows:
using (var httpClient = new HttpClient())
{
var response1 = await httpClient.GetAsync(url1);
var response2 = await httpClient.PostAsync(url2);
var response3 = await httpClient.SendAsync(url3);
}
That just gives you the response. Typically you'll want to look into the content, especially for GET requests. You can do this by:
var content = await response1.Content.ReadAsStringAsync();
That merely gives you the string in the content, so if it's JSON, you probably want to use something like JSON.NET (Newtonsoft.Json) to deserialize it into structured classes.
This is from memory so you might need a little tweak here and there.
To do this I'm using the NuGet feed https://api.nuget.org/v3/index.json
In my project.json I currently have these relevant dependencies and just use the "dnxcore50" framework:
"Microsoft.AspNet.WebApi.Client": "5.2.3",
"System.Net.Http": "4.0.0",
"System.Runtime.Serialization.Xml": "4.0.10"
Then I'm using HttpClient. Right now (beta7) it doesn't work on Linux or OSX because of https://github.com/dotnet/corefx/issues/2155.

Open local file with AIR / Flex

I have written an AIR Application that downloads videos and documents from a server. The videos play inside of the application, but I would like the user to be able to open the documents in their native applications.
I am looking for a way to prompt the user to Open / Save As on a local file stored in the Application Storage Directory. I have tried using the FileReference + URLRequest classes but this throws an exception that it needs a remote url.
My last resort is just copying the file to their desktop : \
You can use the new openWithDefaultApplication(); function that's available on the File class (I believe it's only available in AIR 2)
eg:
var file:File = File.desktopDirectory.resolvePath(fileLocation);
file.openWithDefaultApplication();
Only way I could figure out how to do it without just moving the file and telling the user was to pass it off to the browser.
navigateToURL(new URLRequest(File.applicationStorageDirectory.nativePath + "/courses/" + fileName));
This is the first release of the FluorineFx Aperture framework.
The framework provides native OS integration (Windows only) support for AIR desktop applications.
The framework extends Adobe AIR applications in a non-intrusive way: simply redistribute the provided libraries with your AIR application, at runtime the framework will automatically hook into your application.
Features
Launch native applications and documents with the provided apsystem library
Take screenshots of the whole screen with the provided apimaging library
Access Outlook contacts from an Air application with the provided apoutlook library
http://aperture.fluorinefx.com/
Currently adobe is not supporting opening files in there default applications. Passing it off to the browser seems to be the only way to make it work.
You could however use a FileStream and write a small html file with some javascript that sets the location of an iframe to the file, then after 100ms or so calls window.close(). Then open that file in the browser.
For me it's:
var request:URLRequest = new URLRequest();
request.url = file.url;
navigateToURL(request, "_blank");
The navigateToURL(file.nativePath) didn't work since the path, "/users/mydirectory/..." was outside the application sandbox. AIR only allows some protocols to be opened with navigateToURL().

Resources