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

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.

Related

i want to ask for external storage access from the user to delete the files(songs)

File file = File(widget.singleTrack!.data);
try {
file.delete();
if (await file.exists()) {
print('Song not deleted');
} else {
widget.allSongs!.remove(widget.singleTrack);
}
} catch (e) {
print('$e');
}
This code does not work for external storage .
I think you need to append the root path of external storage which varies from OS to OS and device to device but with the help of ext_storage you can achieve it. Also take a look at this question
Regular File.delete() method would work for android 10 and below if you have writing permission but for android 11 and above you'd have to get the all files access permission.
To do so add this line in you android/app/src/main/AndroidManifest.xml,
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"/>
And get the user to grant the permission like this,
if (await Permission.manageExternalStorage.request().isGranted) {...}
NOTE: Google doesn't appreciate this method. To properly delete you'd have to use MediaStore API for which you'd have to use native.

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" />

Uploaded AAB. have no permission but, try to change target error : you must remove the request for location permission

Uploaded AAb. have no permission but, when I try to change target under 13 Error show : you must remove the request for location permission.
Image that show Abb have No Permission
Error Show On Change Age Rating
If I'm not wrong, Admob includes the ACCESS_FINE_LOCATION
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
And multiple other location-required permissions, to locate ad types and language.
So if you want to upload it for <13, you should remove AdMob.

Can't use POST method in Ionic 3

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"/>

new firebase update: popup window for Google Auth does not show up in Ionic

I recently updated to the new firebase that just came out a few days ago. Since it does not have a Cordova/Ionic special page, I assume that I would need to use the one for Web. I got everything set up, but the signInWithPopup function does not work on actual phone device. It works fine in web browser. I have whitelisted firebase before for the previous version and everything was working just fine for the previous version.Does anyone have any idea? Any help with be appreciated it!
firebase.auth().signInWithPopup(provider).then(function(result) {
// This gives you a Google Access Token. You can use it to access the Google API.
var token = result.credential.accessToken;
// The signed-in user info.
var user = result.user;
// ...
}).catch(function(error) {
// Handle Errors here.
var errorCode = error.code;
var errorMessage = error.message;
// The email of the user's account used.
var email = error.email;
// The firebase.auth.AuthCredential type that was used.
var credential = error.credential;
// ...
});
Here is what's in my content security policy
<meta http-equiv="Content-Security-Policy" content=" img-src &apos;self&apos; data:
http://*.google.com
http://*.gstatic.com
http://*.googleapis.com
http://*.firebaseio.com
https://*.google.com
https://*.gstatic.com
https://*.googleapis.com
https://*.firebaseio.com
Finally I allowed naviagation for everything in my config.xml
<allow-navigation href="*" />
Popup and redirect doesnt work on mobile device. You may need to use cordovaOauth or any other 3rd party to get the access token, and then use signInWithCredential() to authenticate users and get the firebase user data.
Here is a good example:
http://www.clearlyinnovative.com/firebase-3-0-ionic-facebook-login
Currently Firebaseu V3 auth's signInWithPopup/Redirect do not work in cordova apps.
In my Ionic2 RC1 + Firebase3.5 + AngularFire2.beta5 project I had the same problem... Google Auth with Popup worked in Browser but not in my Android .APK
Firstly, I add 192.168.1.172 to my Firebase Console authorized domain list and <allow-navigation href="http://192.168.1.172:8100"/> to my config.xml.
After this, I found that installing Cordova InAppBrowser plugin solves my problem definitively.
I didn't need to modify my code, only plug and play, exactly like David East says in his Social login with Ionic blog.