Show Warning message When User is from different country/region android studio - android

I want to get user from canada or USA (can use vpn) in my android application. If any user under the network of other countrybased location, The application will show him/her a warning message and close the application. If connected to vpn in canada or usa, it will give the access of using application.
I have no idea about it. Please help me out.
I am using android studio for coding a mobile application.
Thanks in advance.

Related

How do apps like Telegram and Twitter automatically detect country dialing codes without asking for location permissions? [duplicate]

This question already has answers here:
How can I get my Android device country code without using GPS?
(10 answers)
Closed 2 years ago.
I am building a flutter app and I am asking the user to enter their phone number to get started with signup on the landing page just after the splash screen. I do not wish to ask location permission at this stage because I feel it will affect the user's experience.
I had a look at the Telegram and Twitter apps and noticed they are detecting the dialling code even without asking for android permissions.
I am assuming they get the users country and then based on that display the dialling code. But how do they get the country and is it legal to get the country code without asking for user's permission?
I guess from your ISP/IP address?
There are API's available that can guess the country and more based on IP.
https://ip-api.com/
https://kickfire.com/api
Some ISP's are also only available in certain countries and they have a fixed range of IP addresses.
What I suggest to you is to import this package to your pubspec.yaml:
https://pub.dev/packages/intl
Then in Your code simply call:
final _countryCode = Localizations.localeOf(context).countryCode;
It will get the country code of the device locale.
Didn't tested yet, but this method should work, enjoy :)

App registration to access Uber api

I have been trying to link Uber api to my app.
The User registration is successful but when i tried to create an app it says "Before you can create an application, we need to confirm your phone number."
How do i confirm my number to proceed further ?
Any input ?
To confirm your mobile number, just text the word go to 827-222.
If you don’t get a reply saying that your number was confirmed or the response is "Message blocking is active," your mobile service provider may be blocking you from texting our number. Give your provider a call to see if they will let you text 827-222.
Google Voice users may have to login to http://google.com/voice in order to text the word go to 827-222.
Still having trouble confirming your mobile number? We can help you at t.uber.com/support
If after doing this, and you still cannot create an application, please try to logout of the developer portal by visiting:
https://developer.uber.com/apps/logout
There was a caching issue where the developer portal didn't recognize when a mobile number was successfully confirmed.
Go to this link on uber Help page and enter your mobile number. Somebody from their support will get back to you over email. Explain the issue to them and they will resolve it for you from their internal tool/backend system. This is how I resolved it for myself.

prevent un authorization for iOS and android app

I am developing iOS and android application. I want to prevent the user from logging in into the app from the different devices which may have different sim card into the devices.
For Example, If user has device A and he logged in into the app, then he cannot get log in into the app from other devices called as device B which has different sim card. Also, please note that if the user has a same mobile number on different devices, then he is an authorize user and can log in into the app.
So, Can i put restriction based on user's sim card details? or else what can i do to prevent the users from getting an unauthorized log in into the app?
Any help will be appreciated. Thanks in advance.
You can use IMEI number of devices. By using IMEI number you can restrict them. Hope it helps. Thank you!!

Get facebook friends in 2.0 (only ones using app) not working for sandbox app

I'm requesting friends list in my app (an app that has not been yet approved) for testing. One of my coworkers is added to the developing role and he has executed the app in his android device and accepted the application. The application is listed under games in his profile.
I have done the same. I have executed the app in my device and accepted the permissions (I'm administrator in roles). Me and my coworker are friends on facebook.
The problem is that when I run /me/friends in the graph api explorer I always get an empty array. I know facebook changed the friends thing to only show friends using same app but my coworker and me are friends and we can't see each other.
We have spent almost all day on this if anyone could help I would really apreciate it.
More info:
I have noticed something: There's a combo in the Graph API Explorer where you can select the Application. If I select my application (the one I will put into production later) and run the query nothing is returned. But If I select a test application I have just created it works ok (If I select as application "Graph API explorer" it works too. Could anybody guess what is happening?
Thanks in advance.

Android - user permission for contacts and location info

By default, my android app which I am developing needs the location and the phonebook of the user who installs the app. The counterpart iPhone app pops up with the dialog and ask for user authorization to use both the address and the location info. Whereas, in Android I am not seeing any pop up or restriction in both the simulator as well in the actual physical device in which I am testing.
Can I safely presume that all apps once installed in the android environment will be granted both the location and phone book contact details. Please let me know. If not, is there a way of setting the permission through code or prompt the user for authorization in android?
Thanks for your time and help.
On Android, permissions like these are presented to the user at install time and they must accept them all to continue with the installation so yes.
According to the Android documentation:
The permissions required by an application are declared statically in that application, so they can be known up-front at install time and will not change after that.

Categories

Resources