Why Rest API's are not working in flutter web? - android

My API's are working fine in applications but if I'm trying to call API with web so API's are not working
API's are implemented with dio (https://pub.dev/packages/dio)
Welcome for the improvements and thanks in advance for solutions and suggestions.

This is a CORS (cross-origin resource sharing) issue. You need to enable the CORS request on your server-side to fix this. Depending on your setup, you won't be needing to make changes on the client app.
Common workarounds made here for development builds is by disabling security using --disable-web-security argument when the app is run.

Related

Cordova/Phonegap AJAX iOS not seem to be getting responses

I have a phonegap/cordova application and I need help.
The app connects to my client's WordPress sot via REST API to pull subscriber's info and use it to unlock features.
ita working flawlessly on my end (android and ios) however on my client's ios phones, it doesn't seem to work.
any ideas as to why it isn't working on their end and works on all my devices?
Thanks!
Make sure they haven't activated the option that allows connection to a whitelisted set of websites only. Anyway, this issue you are reporting is getting more and more common in the recent weeks, it seems Apple has introduced something new to bother developers (even more)? What iOS version are they using?
There are some issues in the latest version of iOS 11.3, that causes this type of issue. Also do check whether URLs of all the REST APIs given, must be of the the cloud or server on which its hosted.
It can be one of the issue done by mistake.

How do i secure my Google Maps API?

I read in the Google help that I have to setup some proxy on my own server for this.
I don't have my own server and doing just learning programming through apps. I have an app ready which uses API for DirectionServices.
Is just turning on ProGuard sufficient or should I do more?
Thanks in advance
After some research, I've found out that using ProGuard is sufficient for most independent developers. If you are running an enterprise system obviously you need to setup a proxy and let you requests run through them

Change system Proxy settings using Android SDK

I'm migrating a Google Chrome extension that I made to an Android version, but I'm facing some questions.
It is basically a Proxy server for certain websites that were blocked in my country. This is working on Chrome by changing the proxy settings with our proxy and with a PAC file that specifies which sites should be proxied.
How can I change the system proxy settings using the Android SDK? Is it doable? If not, what suggestions do you have to have this done?
Thank you so much.
Ok, so after A LOT of investigation, I concluded that this is not a good idea. Also, in most recent Android versions, use an app to set a proxy is mostly impossible.
I've decided a different approach and use a VPN. It works, but is not as lightweight as I would like it to be.

Fire HTTPS requests

I have an android project which uses cordova. I am firing some http requests. It works fine. But when I generated signed apk, the firing is done as https requests. Android studio does not support this type of requests. How can I find an alternate solution for this? I tried Phonegap Android app ajax requests to HTTPS fail with status 0 but this answer is outdated as Cordova 4.0.0 does not have this method .Please help me out.
#Nevin, an alternative in HTML5 is to leave out the http (or https).
Instead of this:
https://domain.com/request/
Write:
//domain.com/request/
This is support by many browsers. It is a way to fix a common problem, where the javascript is on a secure connection, but the webpage is not.

SalesForce with Android?

I want connect sales Force from my Android Program please suggest which one is correct way to achieve this I am new to sales Force I have some knowledge in Android Application Developement.
Thanks in Advance.
You definitely want to use the REST API for mobile apps. The SOAP API is really heavy, and is better for Server-to-Server integrations. The best way to get started building an Android app for Salesforce.com is to take a look at the Salesforce Mobile SDK for Android:
http://wiki.developerforce.com/page/Mobile_SDK
There's a very helpful getting started PDF linked on that page.
However, the SDK is meant mostly for starting new apps, so you'll have some work ahead of you integrating it into an existing application. The main things you want are the oAuth 2.0 User-Agent login and REST wrappers.
You may also find this app useful -- I put it together for a presentation at Dreamforce '11, which was shortly before the Mobile SDK for Android came out, so I wrote the oAuth and REST stuff myself. Might be a simpler starting point for you.
https://github.com/tomgersic/DreamforcengerHunt
Hope that helps!
You can either use the RESTful interface or the SOAP webservices. The latter is a bit easier to deal with IMHO.
Under setup in salesforce, download the partner or enterprise WSDL (partner = generic, enterprise = specific for your SF-instance). Now with wsdl2java you can create Stubs for those wsdl entries. Import those into your android app and use them. See here for a Java Exampe by Salesforce.com.
Be sure your user has the permission to "do API". You might want to look into SSO if you want to make a "production"/commercial app. Also, to login, remember to use the correct password, you might need to add the API key (generate using the Setup tab in SF). Hope this helps.
Try checking out some of the open-source SDK projects the developer evangelists have added to the forcedotcom github
Lots of good examples on different platforms, including android with phonegap/html5 and a native SDK for android (iOS and Android) to get you past authentication and onto building your app.
Salesforce Provides mobile SDK for development on mobile device, here is the link for android SDK:
http://wiki.developerforce.com/page/Getting_Started_with_the_Mobile_SDK_for_Android
You need to:
Download SDK.
Add a sample project included in SDK's native/SampleApps folder(make sure you check include to the workspace while importing the project).
Get your remote access form salesforce and update in your app.
--This should get you started with a sample app form salsforce.
After this you need to modify existing code to your own code.
You can go to trailhead and start browsing on it, while working with your own application you will have to learn a lot about smartStore and smartSync,
I did implemented A smartStore App with using salesforce as database provider, if you want i can upload it to drive and share a link to you and
if you have any doubts about using or understanding the flow be free to ask..

Categories

Resources