android GPS location doesn't work? - android

I'm new to android development and I tried 2 tutorials to get the current location but neither of them work for me. I get the exact expected layout but instead of showing the location, it appears to be totally blank as if the command that sets the text field doesn't exist. The logcat doesn't show any exception that's why I didn't post it. Everything else looks normal.
I thought it might be something related to the permissions that must be ran in realtime starting from android 6.0 but this tutorial that I've tried deals with that issue, besides doesn't the lack of permissions throw a security exception ?
Here are the two tutorials that I've followed exactly as they are:
http://demonuts.com/2016/12/30/get-current-location-android-studio/
http://www.viralandroid.com/2015/12/how-to-get-current-gps-location-programmatically-in-android.html

For maps to working you need to put google_maps_key into google_maps_api.xml which is under values folder. You get this key in google api manager.

Related

Android, set JCIFS log level

From the web, I have seen two answers. One is setting -Djcifs.util.loglevel=3 and another is calling jcifs.Config.setProperty("jcifs.util.loglevel", "3").
I do not know how to do the former one in Android Studio, so I did the latter one. But I see no addditional logs (or any difference), so I am not sure whether it worked or not.
Is it possible to use the former method in Android?
How can I know the log level is correctly set? Any way to confirm that additional log is coming from JCIFS?
Android SDK 25 (7.1.1 Nougat) and JCIFS 1.3.17.
I looked into its source code. It was checking LogStream.level. So, I did the following, and it started printing debug messages.
LogStream.setLevel(10);
Why didn't the methods that the web sites showed work?

Strange issue with Google Maps display

I am facing a strange issue with my app - if I specify a wrong API Key, I get an authentication error as expected but when I specify the right key, I don't get any error message but just a blank screen. What is even more strange is that when I use the same Google Play Services project in a test project, the map loads and is displayed properly.
I have set the Build Target as 21 for both my app as well as the Test project. Please let me know if you might know the reason. Appreciate your help.
Check you've put the API key into the correct google_maps_api.xml. It me a couple of hours to notice there are two. One for Debug and one for Release.
Finally figured out the reason - all the processing was done on the UI thread, and my phone being slower, was dropping the UI processing. Moved most of the logic to a separate thread and the map started to get displayed.

How Do I Get Rid of White Space in a Project Location

I just started using Android Studio and I'm trying to change the project location of my projects to my external hard drive for easier use when I'm on my laptop somewhere else. But I get this message:
Your project location contains whitespace. This can cause problem on some plateform and is not recommended
I read in another post that one person just suggested to not have white space and I was wondering how I could get rid of that. And if I can't what kind of problems would I face. The other post from 2 months ago said importing and exporting would be an issue but wasn't very specific. If it means all exporting then I guess I'll just deal with having it on my main drive instead of the external.
extra : I would love any extra information about this kind of white space because every time I try to google it I get different kinds of white space questions that don't relate to file locations
I overcame this issue - I changed mine to c:\ProjectName\FolderName\AppName

MapView doesn't display tiles - debugging strategies?

There are a number of posts (both here & elsewhere) about why a MapView might not be displaying tile info (personally, I've liked Android "Hello, MapView" Tutorial - Map Tiles Do Not Load, but there are other good ones, too).
My question is slightly different: I'm not getting tile info to show up (on my handset or in the emulator), and I'm looking for advice on what to try in order to debug this problem. As far as I can tell I've correctly located my debug.keystore, and used the Java JDK keytool to get the signature from it, which I then plugged into the Google web page, and then plugged THAT key back into my XML file. The app runs ok, it just doesn't display any tiles.
I was hoping that if I did something wrong here I'd see an error message in, say, logcat (or an exception that Eclipse might catch) that would confirm that this is the source of the error.
So here's my question - what would y'all recommend someone try in order to figure out what the actual problem is?
Step #1: See if the built in Maps application works. If it does not, you have problems with the device.
Step #2: Triple-check that you have the INTERNET permission correctly defined.
Step #3: Triple-check that you have a proper API key.
Step #4: Return to Step #1. :-)
I have many sample Maps applications scattered throughout my books -- here is the simplest one.

Android "Hello, MapView" Tutorial - Map Tiles Do Not Load

I am new to Android software development and new to this site. I am hoping someone might have some experience with the problem I am having.
I've been following the Hello, MapView tutorial in order to not only learn the Android framework, but also the Google Maps library. I've tried my best to implement things exactly as the tutorial has instructed. My problem is that the application does load in my emulator (or even on my phone for that matter), but the map tiles do not load.
Searching Google I found a post by someone else on another site having the same issue, but his/her problem was that the important elements added to the AndroidManifest.xml file were not in the right order. I double-checked this in mine, but everything seems to be right.
So, I am not sure what the issue is and was hoping others have seen this before. I can provide any snippets of code, if that would help.
Thank you.
Non-loading tiles are usually the result of not having the API key set up correctly. Obtaining a Maps API key
To answer the response you left to d.: If you want to have it "just work" when you run from Eclipse you'll need to get an API key for your debug certificate. There's instructions on the same page as before. Do note that you'll have to swap back to your other key before publishing though.
I am guessing the issue is not that you have an incorrect map key, but that you do not have the proper keystore setup. The application needs to be signed by the same keystore you used to generate the map key. You've noted that you can get it to work when you sign the application yourself, but you need to setup a debug keystore in order to use the Maps API with regular Eclipse builds.
All Eclipse builds require a debug keystore; you just normally don't notice it because ADT generates one for you automatically. You should either follow the directions here and create your own debug keystore, or you should take the debug key that ADT automatically created for you (it'll show you where it created it in Windows > Preferences > Android > Build) and sign up for another Maps API key. That key will work with Eclipse.
(P.S., this does make it a hassle to compile for release, as you need to switch your key back and forth depending on the signing keystore.)
I had the issue of tiles not loading as well. As you mentioned your original post, one possibility is with the ordering of elements in the AndroidManifest.xml file. Specifically, I originally had the line:
<uses-permission android:name="android.permission.INTERNET" />
after the application element. Once I moved this line before the application element, my map tiles started loading again.
The tiles not loading is almost always a result of using an inaccurate API-key, i think. Have you checked yours?
Details: Obtaining a Maps API key
I had the same problem... my error was in the manifest file puting INTERNET permissions inside application. After moveing it out (upside) everying was working good.
Make sure you have 3g on the top panel. If you don't then there is no internet connection. Sometimes I have to turn the emulator on and off a couple of times to get 3g to come up.
d. is probably correct. However, Internet problems will also cause similar symptoms. Be sure that your INTERNET permission is properly positioned and that there are no proxy servers/firewalls impeding access to the Internet.
Another problem could be a proxy that you are behind. The proxy slows things down a lot and it will effect your app even though the maps app and internet browser in the emulator work fine.
This is old question, but here is one more answer: if you are as hasty as me, you might accidentally copy the finger print code instead of API key from the web page :)
The Hello, MapView tutorial your were talking about is no longer valid. New V1 map applications can no longer be done.
Follow https://developers.google.com/maps/documentation/android/ for Google Maps Android API v2 applications.

Categories

Resources