Can't use POST method in Ionic 3 - ionic-framework

I have application that is on App Store.
While developing it, I tested in both Android and iOS.
It works perfectly fine in iOS, right now. However, in Android, I can't login using my RESTful service.
Here is the error visible in remote debug console;
I don't know what does the error trying to tell me? I don't understand why it works in iOS, but not in Android; while it was working past days. I didn't change a thing.
When user hits to Login button, below method is executed;
this.loginService.Login(this.inputName, this.inputPassword).subscribe( () => {
// Route user to home page!
});
The method above is implemented inside login.service.ts. Inside this service, it uses the ApiService class which is defined in api.service.ts

It could be a permission issue. Add these lines in your "platforms/android/AndroidManifest.xml" file and try:
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>

Related

Get user call logs in flutter

I am new to flutter currently i am creating a flutter application where user need to get call history, i have done this in in java(native app) but i have no idea how to do this in flutter . and one more thing how to get run-time permissions for this I have checked documentation of flutter but got nothing related to this.
thank you .
use call_log plugin available in pub.dev
here is the link : https://pub.dev/packages/call_log
the only problem here is that this plugin is only supported in Android.
you can use it like this
Iterable<CallLogEntry> _callLogEntries = <CallLogEntry>[];
_callLogEntries = CallLog.get();
do not forget to add call log permission in menifest file
<uses-permission android:name="android.permission.READ_CALL_LOG" />

Empty data and null status in axios return

I made an app using nativescript-vue and axios. I am using android emulator from android studio.
So my app was working last week because we did this checking. Now I want to make updates to this app but when I try to login, it returns empty result.data and null result.status
I've tried checking it in Postman to see if maybe the error is in the api but its working properly:
I also consoled the user login details:
Here's the consoled axios result:
here's my method:
Any help to maybe point me to the right direction is much appreciated. Thank you.
if you are awaiting the axios call then use this syntax:
const response = await axios.post({ method:POST, url:'someUrl',data:'somedata' }, newPost);
and then log the response variable to see if that works.
I was facing this issue as well, adding
android:usesCleartextTraffic="true"
To my AndroidManifest.xml solved the issue.
<application
android:usesCleartextTraffic="true"
android:name="com.tns.NativeScriptApplication"
android:allowBackup="true"
android:icon="#drawable/icon"
android:label="#string/app_name"
android:theme="#style/AppTheme">
....
<application>

cordova-plugin-appavailability is not detecting facebook app

I am using the AppAvailability cordova plugin to check if the facebook app is installed on a device from my own app.
In order to test its working, I have the facebook app installed on my iOS device. the appAvailability.check() should therefore execute the success function however it is executing the error callback function instead. Can you help? (I am unable to post the issue on the github page as issues are closed.)
I have this in the config.xml
<plugin name="cordova-plugin-appavailability" spec="0.4.2" source="npm" />
and in my javascript i have the following:
var scheme = "fb://";
appAvailability.check(
scheme, // URI Scheme or Package Name
function() { // Success callback
alert(scheme + ' is available :)');
},
function() { // Error callback
//this is being executed even when the fb app IS installed.
alert(scheme + ' is not available :(');
}
);
Sample I'm showing is for ios. Make sure you edit the plist (platforms/ios/appname/appname-Info.plist) file for your app and add facebook.
<key>LSApplicationQueriesSchemes</key>
<array>
<string>facebook</string>
</array>
In your androidmanifest.xml file just add the below code on above or below tag.
<queries>
<package android:name="com.whatsapp" />
<package android:name="com.whatsapp.w4b" />
</queries>

Appcelerator Facebook module doesn't fire login event

Appcelerator 5.2.0 Facebook Module (Android) doesn't fire 'login' event after successful logged in.
What could it be?
var FB = require('facebook');
FB.initialize();
FB.permissions = ['public_profile', 'email', 'user_events'];
FB.forceDialogAuth = false;
FB.addEventListener('login', function() {
alert('login');
});
FB.authorize();
Thanks!
Hello Oxana,
Additional Android Setup Steps
Since Facebook module v4.0.0, for the Android platform, you need to:
Add the Facebook Login activity to the Android manifest
Add the Facebook App ID to the Android resources string.xml file
Create a Facebook proxy and associate it with the current active activity (you need)
Manifest:
<ti:app>
<android xmlns:android="http://schemas.android.com/apk/res/android">
<manifest>
<application>
<activity android:label="#string/app_name"
android:name="com.facebook.LoginActivity" android:theme="#android:style/Theme.Translucent.NoTitleBar"/>
<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="#string/facebook_app_id"/>
</application>
</manifest>
</android>
<ti:app>
Add the Facebook App ID to Android Resources
Add a string element to the /platform/android/res/values/strings.xml file with the name attribute set to facebook_app_id and the node text set to your Facebook App ID. Create the file if it does not exist.
<resources>
<string name="facebook_app_id">FACEBOOK_APP_ID</string>
</resources>
**I think this step is that you need =D **
Create a Facebook Proxy
Use the createActivityWorker() method to create a Facebook proxy. Pass the method a dictionary with the lifecycleContainer property set to the current active instance of a standalone Window (window not contained in a tab group) or TabGroup. Create the proxy before calling the open() method on either the window or tab group.
The Facebook module needs to hook into the lifecycle events of the current active activity in order to synchronize its state between various activities in the application, for example, to update the label of the Login button when the user logs in or out of Facebook.
Attach the proxy to the Window or TabGroup object, so it does not get garbage collected.
win.fbProxy = fb.createActivityWorker({lifecycleContainer: win});
Documentation: Facebook module

Android - Why do location services not work using restricted profile?

I am creating a mobile app using Appcelerator that uses Geolocation to get coordinates at specific times based on user action. On iOS it works perfectly, and on Android it works perfectly but only when logged in as the owner of the device, NOT when logged in under a restricted profile. When logged in under the restricted profile one of two errors occur: 1) location is currently available or 2) Can't access current location. I've made sure that the location services are turned on under the restricted profile.
Here is the uses-permission section of the AndroidManifest.xml:
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION"/>
Here is the Geolocation function I am using:
if (Titanium.Geolocation.locationServicesEnabled == true)
{
if (platform == 'android')
{
Titanium.Geolocation.Android.accuracy = Titanium.Geolocation.ACCURACY_HIGH;
}
else
{
Titanium.Geolocation.accuracy = Titanium.Geolocation.ACCURACY_HIGH;
}
Titanium.Geolocation.locationServicesAuthorization = Titanium.Geolocation.AUTHORIZATION_WHEN_IN_USE;
Titanium.Geolocation.distanceFilter = 5;
Titanium.Geolocation.preferredProvider = Titanium.Geolocation.PROVIDER_GPS;
Titanium.Geolocation.getCurrentPosition(function(e){
clearTimeout(timer2);
setTimeout(function()
{
if (!e.success || e.error)
{
alert('Error: ' + e.error);
//alert('An error occured getting your location. Please close and try again.');
return;
}
currLongitude = e.coords.longitude;
currLatitude = e.coords.latitude;
CheckSave();
}, 2000);
});
}
else
{
alert('Please enable location services.');
}
I am using a setTimer in the getCurrentPosition to give the device enough time to get the coordinates. Again, the only issue I'm having is using the app on an Android device logged in under a restricted profile. What can be done about this? Thanks in advance for any help on this issue.
Found the issue and resolution. Issue: I installed under the owner profile and used the app testing functionality, then switched to the restricted profile. Data that had been stored during use under the owner profile still existed. Resolution: Clear data on the app under the RESTRICTED profile and run the app...problem solved! Hope this helps someone else out cause this plagued me for 3 days.