Is it possible to send Twitter auto-reply without GPS tracking? - ios

I want to send an auto reply to the user's tweets from his iOS application, I am able to do that if the user has allowed the iOS application to access his location, but when the access to location is denied by the user, tweeter is not allowing sending the auto reply to tweets.
I'm wondering whether it is mandatory to have access to the user's location to send an auto reply to his tweets. Or, do we have some reliable way to accomplish the specified functionality without accessing user's location?

OP, from what I understood, you want to find out a given user's location without consented access to the user's phone's location services.
A way to do this, not super reliable I'd add, is to reverse geolocate their IP Address using a server side geocode API.
Mind you, it is not super reliable but might do the trick. You might encounter problems on mobiles, especially due to the erratic nature of their IP Addresses.
Twitter themselves have an API to help on that. For example you could use GET geo/search to find out a place ID closest to a given IP Address using this:
https://dev.twitter.com/rest/reference/get/geo/search
and then you could use that place ID to find out the approximate Lat / Long of the user, using GET geo/id/:place_id:
https://dev.twitter.com/rest/reference/get/geo/id/%3Aplace_id
(there are probably straighter ways of doing this in other APIs aswell but I'm assuming you are already authenticated on twitter's API so I'm trying to give you something easier to integrate into your code)
Let me know if that helps.

I haven't implemented it yet but can guess that Twitter does so to avoid the spam or robotics tweets. So if Twitter gets multiple auto Tweets from same place so he would consider them as spam.
What you can do is after every 8-10 Tweets make new latitude longitude and send this location to Twitter while using auto tweeting.
How ?
Take a default location (lat, long) and you can find add 500m-1km in that location every 8-10 Tweets and use this new location for next time. This method is not reliable but can work in your case.
Note: Use this way only in case when you're not able to get device location.

Related

Swift - Check if website visited

Is there a method or way in Swift to check if a user has visited a certain webpage or website?
I know a question was asked for this already:
How can I access browser history in my iOS project?
Or, maybe, is there a way to track if the phone has made a request from a certain IP?
I just want to create a condition to see if a user has visited my website.
No.
Due to the application sandbox for third party apps, you cannot track/access previous network requests outside your app.
Learn more about app sandboxing here.
The only way I can think of doing this is to get current IP of the user:
Swift - Get device's IP Address
Then do a get request to see if it is in my server logs. But this is not very reliable as they may have visited the website on a different network.
Could request a location one the phone and on the browser then compare lat and long to see if in a radius... still, not a reliable solution.

What happens when you try to log into Facebook from behind China's great firewall?

For a few clients now, I've had a request to hide the "login with Facebook" feature in China, where Facebook is blocked. There are a couple ways I can think of to do this:
1) Use device locale.
Advantage: super simple!
Disadvantage: Inaccurate— someone in China could have their device set to en_US, and someone in the US could have their phone set to zh_CN. No dice.
2) Use GPS and reverse geocoding.
Advantage: You are actually measuring if the person is currently in the territory you've marked as 'restricted'.
Disadvantage: Requires the user to give you location permissions. Unclear what to do as a fallback if the user declines permissions. Some apps don't use GPS for anything else, and adding it just for this would be overkill.
3) Use a reachability check to http://facebook.com.
Advantage: You're going beyond checking whether the user is in an arbitrary location and actually checking to see whether facebook is currently restricted. If China stops blocking Facebook, your app starts supporting it immediately.
Disadvantage: You end up hiding the login UI if you're offline (which might not be a huge problem, because Facebook login won't work offline no matter where in the world you are).
Big unknown: What happens in China when you try to log into Facebook? Does it return a 404? Redirect to another site? Google searches around this (as linked above) just return things along the lines of "how to get around the Great Firewall" rather than "here's what actually happens when it's blocked".
So, the question: What happens when you try to log into Facebook from behind China's great firewall?
Trying to access Facebook in mainland China would result in error, like 403 Forbidden or 404 Not Found.
GPS Might not be a good idea, because the GPS signal in China is drifted, and as a result many cities located on the boundary would get overlapped GPS position, including southern Shenzhen/northern Hong Kong, Zhuhai/Macau, NE China/Russia and such.
How about reading the Mobile Country Code? So that users who are using Chinese sim card in their iphone can be identified and the option for facebook login can be disabled. But this trick would not be useful on iPod/iPad. It would also affect Chinese users roaming outside their country. How about checking if the IP address belong to a Chinese ISP?

Telegram geolocation

I have an idea to use a telegram bot for food ordering from a smartphone. So, you have a menu, prices, there is a payment gateway. This part seems clear to me.
I was wondering if there any way to get a geolocation information inside telegram? So smartphone owner location is sent automatically.
The alternative I see are:
writing address thru telegram (too much work and probably restaurant has to call back);
Install a small Android/iOS app just to send a location to the service. Kinda feels awkward, but a little better that first option.
Maybe you can see better ways, perhaps telegram already got some related functionality?
Thank you!
On some step (don't do it too early) you can send a button with the request_location field set to true.
When the user presses that button, Telegram asks the user if he wants to share his location with the bot.
The user then sends a location. Note that the user could also spoof the location.

Is it possible to use geolocation without asking user permissions?

I have read all the posts relating to this probelm, but none of them seem to match my request close enough to help me.
I have a weather widget on a website which uses geolocation to determine the location, is it possible to automatically grant permission without the user being asked for permission?
It is up to the browser to determine whether to provide geolocation information (in the HTML5 sense; after all, you can already determine limited data from their IP address). Whilst there may be some browsers that provide the information silently, none of the mainstream ones default to this behaviour.

How to Add Phone With twitter using Third Party tool

I need a script that will add my phone with Twitter for All latest notification.
I found this page Twitter but i need to create script for my own application.
I goggled but i didn't get any solution For this.Please Help me to find this answer.
Thanks a lot in advance.
First Edit
This is a twitter's new feature Send notification to Phone. Actually I want to create an app that will allow users to register there phone with twitter via my application. Ie I need a script to implement send notification to phone.
The question that others are asking you Pankaj is what platform is your application being written for. You keep saying you want a "script" to do this, but what kind of script?
Giving us more insight to what your application is (a console application written in C#, or an ASP.NET web application) would lend more detail and raise the chances of someone being able to help you. :)
Regardless of your app's platform though, you're probably going to need to look into the Twitter API for setting this up. This is the normal method to interact with Twitter from 3rd party applications. So all the suggestions above, specifically the list of API's available, is probably what you're looking for.
Hey, can you give some more information? What kind of Phone are you developing for?
Maybe that helps solving your Problem.
If you are just searching for a way connecting your Phone to Twitter, here is the Twitter FAQ for Phone connecting:
http://support.twitter.com/articles/14014-twitter-phone-faqs
Maybe it helps, or give you more keywords for your search.
I don't believe there's a way to get or set the notification phone number using the API, however if a phone is already setup on the profile you want to configure, you can do the following to get notification from all user friends.
The user will need to authorize your application to access her account. This flow uses OAuth, and begins here:
http://api.twitter.com/oauth/request_token
Once the user has granted your app access, and your application has all the required OAuth credentials, turn on notifications using account/update_delivery_device:
http://api.twitter.com/1/account/update_delivery_device.json?device=sms
Next, fetch all the IDs for your user's friends using the friends/ids API call. Be sure to study the documentation; this call uses cursors, so you will have to manage those if the user has over 5,000 friends. Store these IDs for use in the next step. Here's an example call:
http://api.twitter.com/1/friends/ids.json?cursor=-1
Once you have all of the friend IDs, you can call notifications/follow repeatedly to enable notifications on your mobile device whenever your friend makes an update:
http://api.twitter.com/1/notifications/follow.xml?user_id=12345
This approach will burn one API call for each user that you enable notifications for; there's no way currently to manage notifications en masse.

Resources