@Override public void onCreate() { super.onCreate(); mInstance = this; AnalyticsTrackers.initialize(this); AnalyticsTrackers.getInstance().get(AnalyticsTrackers.Target.APP); /*facebook*/ FacebookSdk.sdkInitialize(getApplicationContext()); try { PackageInfo info = getPackageManager() .getPackageInfo( "com.jukesolutions.olahdana", // replace with your unique package name PackageManager.GET_SIGNATURES); for (Signature signature : info.signatures) { MessageDigest md = MessageDigest.getInstance("SHA"); md.update(signature.toByteArray()); Log.d("KeyHash:", Base64.encodeToString(md.digest(), Base64.DEFAULT)); } } catch (PackageManager.NameNotFoundException e) { } catch (NoSuchAlgorithmException e) { } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mTracker = AnalyticsTrackers.getInstance().get(AnalyticsTrackers.Target.APP); // Load an ad into the AdMob banner view. AdView adView = (AdView) findViewById(R.id.adView); AdRequest adRequest = new AdRequest.Builder().setRequestAgent("android_studio:ad_template").build(); adView.loadAd(adRequest); // Toasts the test ad message on the screen. Remove this after defining your own ad unit ID. Toast.makeText(this, TOAST_TEXT, Toast.LENGTH_LONG).show(); mText = (EditText) findViewById(R.id.partno); mStart = findViewById(R.id.imageView1); mText.setOnEditorActionListener(ActionListener.newInstance(this)); mStart.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { if (!TextUtils.isEmpty(mText.getText())) { String s = mText.getText().toString(); Intent i = new Intent(getBaseContext(), Game.class); i.putExtra("number", s); startActivity(i); finish(); } else { Toast.makeText(MainActivity.this, TOAST_TEXT, Toast.LENGTH_LONG).show(); } } }); }
public synchronized Tracker getGoogleAnalyticsTracker() { AnalyticsTrackers analyticsTrackers = AnalyticsTrackers.getInstance(); return analyticsTrackers.get(AnalyticsTrackers.Target.APP); }