How do I properly implement Google Play Service Achievements? - android

I've been searching for a couple of days, including on this website. What I have found would be useful, however I find that I'm unable to follow them correctly. The questions here have no answers either.
Firstly, when I attempt to add BasegameUtils to the project and import whats needed, Eclipse cannot find them. I don't understand why, because I have imported it and marked it as a library.
This is not helped by the fact that all of the examples have their mainactivity in the folder where the API is. I have already built a full application, and I do not understand where I'm supposed to put mine.
The whole thing is incredibly confusing, and any help, or examples would be lovely.

https://developers.google.com/games/services/android/init
You need to implement baseGameUtils as a library or module depending on your IDE.
public class Main extends BaseGameActivity
And then you call this to unlock the achievement.
Games.Achievements.unlock(getApiClient(), getString(YOUR_ACHIEVEMENT_CODE));
These code samples really helped me first time round.
https://github.com/playgameservices/android-basic-samples/tree/master/BasicSamples/libraries/BaseGameUtils
The tricky part isn't the code, it's the configuration of your project, make sure to check on the play developer console that you have set up your testing account properly and your achievement codes are correct etc.

Okay, the solution was not simple. The guides seem to favour Android Studio, which implement a script to create BaseGameUtils. The BaseGameUtild that I was importing with Eclipse was not the correct one. I ended up searching for a valid one, and downloaded it.
The second thing I was doing wrong was not updating the SDK to version 20. Now, with the Play Services Lib in the extras, I could import the updated version.
After that, I discovered that gms.; actually must be written as com.google.android.gms..;. With this in line, I am now able to properly implement everything.
Thank you to those who helped.

Related

Where is ProperyLoader class?

I attempted to follow and old tutorial for Sending E-mail with Amazon SES Using the AWS SDK for Android here:
https://developer.amazon.com/post/TxEUZC89WLEC2Z/Sending-E-mail-with-Amazon-SES-Using-the-AWS-SDK-for-Android.html
I am having a little trouble however. PropertyLoader cannot be resolved. What jar library is this a part of? I have tried importing all of the jar libraries from the SDK into my Eclipse project. (http://aws.amazon.com/mobile/sdk/).
I also get an error on this line: SendEmailResult result = clientManager.ses().sendEmail(request); I am guessing there is another class called ClientManager to set this up with in which I am also not able to find.
Any thoughts or links would be helpful. Thanks.
From the tutorial it looks like it follows a sample. Doing a quick Google search finds me this page.
I imagine the clientManager stuff is also there.
Note that the post is very old so I'm not even sure it still works with the current version of the SDK

Many many issues, eclipse, android MediaPlayer, etc

I've recently started android programming, and I'm extremely frustrated to say the least with a lot of things that to me seem simple but are totally holding me back from making any progress. The first of which is the "my first app" hello world that I started a tutorial from http://developer.android.com/training/basics/firstapp/creating-project.html
This tutorial worked fine when I was originally looking into android a while ago. Then when I came back after learning a bunch of java this program will no longer work unless I change the target-sdk to version 10 (I found that solution after extensive searching on this site).
Then I moved on to starting tutorials by thenewboston
All of these work fine as long as I didn't use any new targetsdkversion, so I'm wondering what happened that everywhere I go looking for tutorials I can't find anything that will actually work on the current ADT(4.4W and L are what my eclipse automatically set up) and eclipse (indigo). I'll also get issues saying lint isn't working, or trouble with android SDK content loader when I'm not even doing anything.
I've also found snippets of code example on the developer website that I linked earlier that don't work when implemented either
So, am I missing something, is that just old documentation, or is something up with eclipse and ADT? I'm just so frustrated that everything wants to bug out on me when I'm just trying to follow simple introductory tutorials and I don't even know where to turn for tutorials that I can trust to work..
edit:removed code because it wasn't needed.
To not get blocked What you can do is continue to set "targetVersion as '19'" instead of setting it to 20 or so. Ensure that you've downloaded API19 through SDK Manager and create the AVDs with that targetSDK version for checking you apps.
That way you can proceed ahead with your coding and later when things get resolved by google for API20...you can always comeback to that new version. This way you can follow 'TheNewBoston' and start coding in Android.
I also recommend 'Slidenerd' tutorials over youtube as well for the beginner.
BTW, I've also selected 'Blank Activity / Empty Activity" during the project creation with API19 and been able to move ahead with my coding.
The Google Bug thread about this latest version issue can be tracked here : The google bug
As a beginning developer, I suggest you use API 19. It has been out for a while and is more stable than L or Google Wear.

Android ActionBarCompat Not working from the start

OK, I have been wanting to try the new ActionBarCompat, however, I am not able to run my programs in the emulator.
I have been trying to implement the following: http://antonioleiva.com/actionbarcompat-how-to-use.
and have been stuck on basically the first part. However, working with the author of that content, I was able to get further as I was not adding the project under sdk\extras\android\support\v7\appcompat folder like stated. However, I still think that might be the reason I cannot do this...
More detail can be found here: http://antonioleiva.com/actionbarcompat-how-to-use/#comment-43
Basically, on my first attempt, I just created an Android project, and changed the source code as indicated. Code would not run on the emulator. So I went back to the original code, and that ran on the emulator.
Checked online, found out I might need to add the \extras\android\support\v7\appcompat folder as a library to the project I am building. So I added that and a new android project was created. There were build errors from the start, but I failed at trying to add it as a library to my project, and deleted it....thinking this was way overboard.
After back and forth chats with author of linked website, I found out I had to do that overboard thing.
So I tried the following link to the T: (I cannot post more than 2 links due to low repuation...I will add this link as a comment below)
However, Eclipse would not allow me to add the appcompat Existing Android Project...but it did allow me to add the appcompat Existing (General) Project. I think this may be some of the problems??
Right now, I cannot run the project at all. Eclipse is showing a red exclamation mark on the project folder, but all the code seems to be fine. So I don't know what to do now...I recreated this project several times over, and this one was the one where I knew what to do...and I am still getting problems
So...
I decided to move to Android Studio...updated the IDE, updated the SDK manager to include the new support library, and other things. Created a new project, added to the build.gradle file as shown in the link provided below in the comment. I ran the ant build, and then built the project...tried to import the right things to allow ActionBarActivity, but I could not get that far.
I can import
"android.support.v7.*"
"android.support.vy.R" // and all folders within
but nothing allows me to add ActionBarActivity, and I don't know why.
FYI, I guess I would prefer a solution to Ecplise, as it seems like I actually got somewhere with it.
The best example to use is from here, and I would follow it closely. I had similiar issues when I first came across this. Problem was I misunderstood what I needed to do
http://developer.android.com/tools/support-library/setup.html#libs-with-res

Android in-app billing example, wrong source files?

I downloaded the Android in-app billing example and imported it into Eclipse. After import I see some strange errors.
There is a source file AccelerometerPlay and the string resources in the Dungeons.java file are not existing.
It seems that the download got the wrong resources. Has anybody seen this and knows how to get the right code?
Of course I can put in my own strings to get rid of the error markers, but I cannot say if something else is missing. So I'd rather have a correct version of the code.
How can I take over this question? It is not resolved for me and I can not up-vote it or comment on it stating this still persists for me. Duplicating the question can't be the solution neither.
More details:
The Dungeons example is not in "Extras/Google Market Billing Package" as shown in the screenshot in their tutorial but in "Extras/Google Play Billing Library"
The version of this is "revision 2".
After removing it via the Android SDK Manager various times and adding it again to re-create the project from source within Eclipse, I now did check the "create Activity .Dungeon" checkbox in the last step and think that did the trick. I'm not eager to verify this assumption ending up without a broken project again though.
In Eclipse and Intellij, if you create a new app over those existing sources (and presumably have it create a default activty like "MyActivity") it will overwrite some of the billing files namely the main layout and the strings file.

PhoneGap BarcodeScanner - ClassNotFound

UPDATE 2
I posted an answer that fixes my original problem. See that for more information.
UPDATE
FYI for anyone wondering, in the end I found this: http://github.com/commonsguy/zxingdemo/tree/master Exactly what I needed to get it rolling was a simple demo that worked! Also, thanks to Sean for pointing me in the right direction for my googling.
I am currently trying to build a simple android app that can scan in a barcode. I have looked through multiple tutorials, tried everything to a T, and re-tried and re-tried. Nothing worked. So now I am going to ask for assistance to see where I went wrong.
To list the tutorials I have followed:
https://github.com/phonegap/phonegap-plugins/tree/master/Android/BarcodeScanner
Tried this one first.
http://www.mobiledevelopersolutions.com/home/start/twominutetutorials/tmt3
http://simonmacdonald.blogspot.com/2011/12/installing-barcode-plugin-for-phonegap.html
Plus a couple others, but more or less hit the point to the same process. Some key points, when I add the LibraryProject to my project as a Library, the app will not compile until I create an AndroidManifest.xml I tried using the one found in the LibraryProject and tried creating a bare mininmal one, both would allow to compile, but the app ForceCloses.
When I load up the App and click "Scan" it ForceCloses and in the debug log of LogCat in Eclipse I get:
java.lang.RuntimeException: Unable to instantiate activity
ComponentInfo{com.myapp/com.google.zxing.client.android.CaptureActivity}: java.lang.ClassNotFoundException:
com.google.com.zxing.client.android.CaptureActivity in loader dalvik.system.PathClassLoader[/data/app/com.myapp-1.apk]
I have tried googling, found a few issues, but no real clear or solid answers, most just point to the tutorials above. I am not sure if the tutorials are just outdated or I am being stupid and am missing something key. Been working on this for a few days now and am at my wits end.
If you can help I would appreciate it. To avoid answers regarding if I have done X or X, here is what I have done.
When I test the application, I do briefly see it trying to load BarcodeScanner, but right after I see that it ForceCloses. I am not sure what I am missing, but for references I will post the code I currently have setup to test:
AndroidManifest.xml - http://pastebin.com/qq9q0ZU7
Plugins.xml - http://pastebin.com/dZ5eKPSU
index.html - http://pastebin.com/wvht4ken
If I need to post any other items let me know.
On Android, it is much much simpler than all this you're trying to do. Throw this out and restart from http://code.google.com/p/zxing/wiki/ScanningViaIntent
Ok, so for anyone having this problem, you have two choices. You can use the ScanningViaIntent, as Sean pointed out. It works great, if you need an example look at CommonsGuy. As for the tutorials I posted above to get this working with PhoneGap, my whole problem was, after I imported the LibraryProject I did not go back through and add the files. I am not sure if a setting in my Eclipse is bad. But I basically just right clicked on the LibraryProject, went to Import -> File Structure -> Library Project's original project path, and loaded all of it back in there.
There is probably something wrong with my Eclipse setup, but yea. I now have the BarcodeScanner plugin for PhoneGap working!

Categories

Resources