Get OpenFeint player id on Android - android

I've integrated OpenFeint into my Android game, and I'm wondering what i need to add in order to get the OpenFeint player id. I want the id or the username so I can allow users to transfer their game accounts between devices, authenticating with OpenFeint.
Here's my code for using OpenFeint:
OpenFeintSettings ofsettings = new OpenFeintSettings(gameName, gameKey, gameSecret, gameID);
OpenFeint.initialize(this, ofsettings, new OpenFeintDelegate() {});

#Andy hi i also needed the player id when i implemented openFeint in the game i developed
I used the following code
import com.openfeint.api.OpenFeint;
import com.openfeint.api.resource.User;
import android.app.Activity;
import android.os.Bundle;
public class ABC extends Activity {
User u;
String Name;
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.score);
u = OpenFeint.getCurrentUser();
// user id received
Name = u.name;
System.out.println("** The User id is ** " + Name );
}
}

If you're not 100% sold on OpenFeint, check out Swarm, which provides a similar set of features (leaderboards, achievements, cloud data save, etc). Swarm's Cloud Data would do exactly what you're looking for, and allow you to save data to a user's account, so no matter what device they're on, they have all of their data available :)

Related

Firebase Android App - not updating realtime database

I experience some errors while trying to push data into my firebase realtime database. I checked a couple of tutorials and according to all of them i am doing nothing wrong. Unfortunately I can not update the database from my android studio emulator device.
I activated debug mode and stepped through every single process and saw that my code actually works because the database responses with the child id when pushing to it.
package com.example.fbconnect;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
public class MainActivity extends AppCompatActivity {
Button btnsaves;
Member member;
DatabaseReference myRef;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
btnsaves=(Button)findViewById(R.id.button);
btnsaves.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
myRef = FirebaseDatabase.getInstance().getReference("Member");
String id = myRef.push().getKey();
member = new Member("MSmith", 12, id);
myRef.child(id).setValue(member);
Toast.makeText(MainActivity.this, "Success", Toast.LENGTH_SHORT).show();
}
});
}
}
When debugging to this line
String id = myRef.push().getKey();
I see, that the database answered with a code. But it will not set the new value or update the value of existing database Childs.
After activating the debug mode I recognised some rare lines in android studio that may lead to the problem:
E/FirebaseInstanceId: Topic sync or token retrieval failed on hard failure exceptions: AUTHENTICATION_FAILED. Won't retry the operation.
I am definitely sure that I did not activate any authentication in my firebase. Normally everybody should be able to read and write (I am aware of this but I am desperate to get this database connection working).
Can you please help me?
If anyone reads this and gets this error,
Firebase Realtime Database connection killed: Different Region
Make sure your google-services.json file has the right firebase_url.
If it doesn't work right away,
Clean Project
Invalidate Caches
After restart, it should be working if that was the case.
Go to firebase console > Database > Firebase Realtime Database > Rules tab Change read and write to true.
Also check if your device is connected to the internet.
By Default Rule in Firebase is for Authorized requests
you can change read and write to True
BUT IT IS NOT SECURE
any one with your Firebase Url Can Access And Change Data

Google authentication ERROR while trying to purchase with soomla iap

need a little help. Im making an android app and integrated Soomla for a simple "No ads" purchase inside my app. Ive a purchase button which should do the actual purchase via google.
What occurs is a popup from google : "Error
authentication needed, You have to login in your google account" .
I think its a small problem, but i dont get what. I am logged in in my google account. Store in Soomla is running ( at least it says so). ive enable test purchase.Im using my phone for the purchase ofc. What i am missing?
public class NoADsButton : MonoBehaviour {
private static bool storeInitialized = false; // prevent store to be initialized twice
void Start () {
if(storeInitialized) return;
SoomlaHighway.Initialize();
StoreEvents.OnSoomlaStoreInitialized += onSoomlaStoreInitialized;
SoomlaStore.Initialize(new SoomlaAssets());
}
public void onSoomlaStoreInitialized() {
storeInitialized = true;
}
public void OnMouseDown(){
StoreInventory.BuyItem("no_ads");
}
And the item ive done as its shown in the soomla example:
public const string NO_ADDS_PRODUCT_ID = "no_ads";
public static VirtualGood NO_ADS_LTVG = new LifetimeVG(
"No Ads", // name
"No More Ads!", // description
"no_ads", // item id
new PurchaseWithMarket(NO_ADDS_PRODUCT_ID, 0.99)); // the way this virtual good is purchased
}
This usually happens when the process of publishing the app for testing wasn't done properly. Try going carefully over Google's instructions, make sure you didn't miss anything. http://developer.android.com/google/play/billing/billing_testing.html#billing-testing-test

Where can i view the data sent by tracker on Google Analytics?

I have sent much data by Tracker to Google Analycis as following codes:
tracker= GoogleAnalytics.getInstance(this).getTracker("UA-46451607-1");
HashMap<String, String> hitParameters = new HashMap<String, String>();
hitParameters.put("type", "appview");
hitParameters.put("screen_name", "My Screen");
tracker.send(hitParameters);
After sent these data to platform,where can i see the result?
I would like to see the value of "type " and "screen_name",but i dont know how to view them on web.
Check it.
import com.google.analytics.tracking.android.EasyTracker;
import com.google.analytics.tracking.android.Fields;
import com.google.analytics.tracking.android.MapBuilder;
public class YourBaseActivity extends Activity {
#Override
public void onStart() {
super.onStart();
EasyTracker tracker = EasyTracker.getInstance(this);
tracker.activityStart(this);
String trackingId = "UA-ABCDEFG-I";
tracker.set(Fields.TRACKING_ID, trackingId);
String category = "Activity Lifecycle Callback";
String action = "onStart()";
String label = "Screen: " + getClass().getSimpleName();
tracker.send(MapBuilder
.createAppView()
.createEvent(category, action, label, 0L)
.build();
);
}
#Override
protected void onStop() {
super.onStop();
EasyTracker.getInstance(this).activityStop(this);
}
}
Then go to www.google.com/analytics/. Click Access Google Analytics.
And on the screen: tab Reporting (at the top panel) -> Real-time -> Events. And you'll see something like this (maybe not immediately, but within a few minutes):
Select category (at the bottom of the figure - here is CATEGORY_ACTIVITY_CALLBACK) and you'll see a number of actions:
But unfortunately I still have not found a way to see "not-realtime" data.
Sorry for my English
Follow these steps
open this link www.google.co.in/analytics/
Click on access Google Analytics button in the right side of the top most corner of this screen.
It will redirect you to your home screen. Here you can see your app name
Click on All Mobile App data link on home screen just below the title of your project
It will redirect you to App overview page.
It is where you want to be . Yo can see complete report and details of your app.
You may want to use Fiddler2 as a proxy to view the data.
open your Google Analycis account. You can check all the details related to the app. use this link
https://www.google.com/analytics/web/?hl=en#report/app-overvi/a46388977w77407404p80019218/
and Sign up the account.
When your offline to see the google analytics report follow the below steps.
Step 1. Go to Reporting
Step 2. Behavior and check Overview and Screens
Note: The total report will submit to google analytics once in 24hrs of time

How can I do an Amazon App Store search using an Intent and filter it by developer name?

Is there a way to start an Intent on the Kindle Fire that will cause the AppStore app to open and display all the apps for a certain developer? For instance, on a phone/tablet with the Android Market installed, I can do this:
Intent otherApps = new Intent(Intent.ACTION_VIEW,Uri.parse("market://search?q=pub:\"" + developerName + "\""));
activity.startActivity(otherApps);
And show all my apps in the Android Market. Can I do that with the Amazon App Store? If so, how? I've tried that Intent with other seemingly valid names (such as "ZeptoLab") and I don't get any filtering. It just drops me in the full unfiltered App Store. Looking up a specific app with "market://details?id=package.name" does seem to work.
From https://developer.amazon.com/help/faq.html#Marketing:
To point to your app for marketing purposes use the URL http://www.amazon.com/gp/mas/dl/android?p=packagename (where packagename is your app package name).
If you want to link to the list of all your applications on the Amazon Appstore use the URL http://www.amazon.com/gp/mas/dl/android?p=packagename&showAll=1.
e.g. http://www.amazon.com/gp/mas/dl/android?p=com.rovio.angrybirds&showAll=1
All this can be seen here: https://developer.amazon.com/sdk/in-app-purchasing/sample-code/deeplink.html
Update(deep linking):
amzn://apps/android?p=
Best way is to look at their website (or here), which currently states this :
search: amzn://apps/android?s=amazon%20mp3 or http://www.amazon.com/gp/mas/dl/android?s=amazon%20mp3
detail page using package name: amzn://apps/android?p=com.amazon.mp3 or http://www.amazon.com/gp/mas/dl/android?p=com.amazon.mp3
detail page using unique ID ("asin") : amzn://apps/android?asin=B004FRX0MY or http://www.amazon.com/gp/mas/dl/android?asin=B004FRX0MY
show all apps of the developer who made the app: amzn://apps/android?p=com.amazon.mp3&showAll=1 or http://www.amazon.com/gp/mas/dl/android?p=com.amazon.mp3&showAll=1
Amazon supports their own deep links now: https://developer.amazon.com/appsandservices/apis/earn/in-app-purchasing/docs/deeplink
E.g. you can start an intent with uri amzn://apps/android?p=my.package.name.
From - https://developer.amazon.com/help/tuabg.html
For in-app advertising or mobile browser based linking, please:
Use this link structure: http:// www.amazon.com/gp/mas/dl/android?p=com.example.package/ref=mas_pm_app_name
For a link that directs to a list of all of your apps within our U.S. store, please:
Use this link structure: http://www.amazon.com/gp/mas/dl/android?p=com.example.package&showAll=1
Now, you think amazon would have this correct on their own website, but the first part that I put in bold is wrong. This is what it should actually be:
http://www.amazon.com/gp/mas/dl/android?p=com.example.package&ref=mas_pm_app_name
Notice the & instead of the / between the package name and ref. Hopefully this helps some other people since this little detail wasted some of my time...
Here's the solution I came up with using the advice below from chiuki:
I added a boolean to one of my resource files that indicates whether or not the app is published in the Amazon AppStore or Android Market. Yeah, you have to change it whenever you publish your app, but think of it sort of like remembering to set debuggable to "false" when you publish. Put it on a check list. It goes like this:
In resource file:
<bool name="app_is_in_amazon_app_store">true< /bool>
In code:
public class SomeUtil
{
private static Boolean isInAmazonAppStore;
public static boolean isInAmazonAppStore(Activity activity)
{
if (isInAmazonAppStore == null)
{
isInAmazonAppStore = activity.getResources().getBoolean(R.bool.app_is_in_amazon_app_store) ;
}
return isInAmazonAppStore;
}
public static void startOtherMarketAppsActivity(Activity activity)
{
try
{
Intent otherApps = null;
if (isInAmazonAppStore(activity))
{
otherApps = new Intent(Intent.ACTION_VIEW,Uri.parse("http://www.amazon.com/gp/mas/dl/android?p=" + getPackageNameInAmazonAppStore(activity) + "&showAll=1"));
}
else
{
otherApps = new Intent(Intent.ACTION_VIEW,Uri.parse("market://search?q=pub:\"" + getAndroidDeveloperName(activity) + "\""));
}
activity.startActivity(otherApps);
}
catch(Exception ex){ /* error handling */}
}

How to reference stage? Using flex for Facebook actionscript mobile API login method

I'm trying to implement the 1.6 Mobile Facebook API (http://code.google.com/p/facebook-actionscript-api/downloads/detail?name=GraphAPI_Mobile_1_6.swc) into an Air for Android application. I've succesfully used the Web and Desktop API's however with the mobile app it's expecting an extra parameter to a stageReference, see:
login(callback:Function, stageRef:Stage, extendedPermissions:Array, webView:StageWebView = null)
But, using i'm using Flex and not Flash CS5, i can't just pass in this.stage or this or anything like that.
What exactly would you guys think I need to pass into that using Flash builder Flex? I can't seem to find any examples for the mobile actionscript API so i'm kinda in the dark, anyone have any ideas?
Here's the login information from the Mobile API Docs:
login () method
public static function login(callback:Function, stageRef:Stage, extendedPermissions:Array, webView:StageWebView = null):void
Opens a new login window so the current user can log in to Facebook.
Parameters
callback:Function — The method to call when login is successful. The handler must have the signature of callback(success:Object, fail:Object); Success will be a FacebookSession if successful, or null if not.
stageRef:Stage — A reference to the stage
extendedPermissions:Array — (Optional) Array of extended permissions to ask the user for once they are logged in.
webView:StageWebView (default = null) — (Optional) The instance of StageWebView to use for the login window For the most current list of extended permissions, visit http://developers.facebook.com/docs/authentication/permissions
If you're using Flex, you have FlexGlobals.topLevelApplication which will point to your mx:Application or s:Application so you can call stage on that to get a reference to it.
Otherwise, any DisplayObject attached to the stage or attached to another DisplayObject attached to the stage, will have it's stage property set (If it's not attached to anything, stage will be null).
Other than that, normally what people do is keep a static somewhere that they can access through the code, that's set when the program starts. For example, your typical main class could be something like:
package
{
import flash.display.Sprite;
import flash.display.Stage;
import flash.events.Event;
public class Main extends Sprite
{
public static var stage:Stage = null;
public function Main():void
{
// if we have our stage, go directly to _init(), otherwise wait
if ( this.stage ) this._init();
else this.addEventListener( Event.ADDED_TO_STAGE, this._init );
}
private function _init( e:Event = null ):void
{
// remove the listener
this.removeEventListener( Event.ADDED_TO_STAGE, this._init );
// hold the stage
Main.stage = this.stage;
// do everything else
...
}
}
}
After that, anywhere in your code, you can call Main.stage to get access to the stage.

Categories

Resources