Azure DevOps / VisualStudio.com hosted version controlling with SourceTree on MacOSX

If you want to access your Git based repository with SourceTree, you need to genereate a Personal Access Token for your account in DevOps. Follow the tutorial above:

https://docs.microsoft.com/hu-hu/azure/devops/organizations/accounts/use-personal-access-tokens-to-authenticate?view=azure-devops&viewFallbackFrom=vsts&tabs=preview-page

After you have done with setting up PAT, set up SourceTree on Mac:

  1. SourceTree > Preferences
  2. Accounts > Add…

Enter your devops server url. ex: https://AnAwesomeCompany.visualstudio.com/
As username, enter your e-mail address
As password, paste your private access token
Set the protocol to HTTPS.

After the success configuration, you will see your remote repositories on the main screen of Remotes section.

This content has 4 years. Some of the information in this post may be out of date or no longer work. Please, read this page keeping its age in your mind.

Xamarin Android: FCM Push notification handling on terminated app: key to the success

If you have ever tried to make an app, that handles a specific type of push notification differently than just simply show a notification to the user, you may have found yourself in trouble. To handle notification receive in a terminated app state, you have to send the payload differently than normal cases.

You should send data only push with high priority to be able to handle the notification by yourself in your app.

The following example shows a perfect payload for Android with FireBase Admin SDK for C#:

			var data = new Dictionary<string, string>();
			data.Add("MessageType", "UrgentNotification");
			data.Add("Title", "Hello Xamarin.Android");
			data.Add("Content", "This notification has been handled by the app");

			FirebaseAdmin.Messaging.Message Message = new FirebaseAdmin.Messaging.Message()
			{
				Token = token,
				Data = data,
				Android = new FirebaseAdmin.Messaging.AndroidConfig()
				{
					Priority = FirebaseAdmin.Messaging.Priority.High,
					Data = data
				}
			};

As you see in the example, the Notification property is completely missing from the payload. But how to handle this notification on the client side? Here’s the solution:

First thing first: Make soure you’re able to receive notifications foreground.
Add google-services.json, make sure the bundlename matches the setting in firebase, etc, etc.

Derive from FirebaseMessagingService

You should make a service, derived from FirebaseMessagingService with an intentfilter to be able to catch Messaging events.

	[Service]
	[IntentFilter(new string[] { "com.google.firebase.MESSAGING_EVENT" })]
	public class MyFirebaseMessagingService : FirebaseMessagingService

OnMessageReceived will be triggered when the application is terminated or it is in foreground. But not even in debug mode. You need to set the build config to release, in order to receive messages when your app is killed by the user. You can display local notification from the data passed as parameter array like this:

if (data?.ContainsKey("UrgentNotification") == true)
			{
				var intent = new Intent(this, typeof(MainActivity));
				intent.AddFlags(ActivityFlags.ClearTop);
				foreach (var key in data.Keys)
				{
					intent.PutExtra(key, data[key]);
				}



				var pendingIntent = PendingIntent.GetActivity(this,
															  MainActivity.NOTIFICATION_ID,
															  intent,
															  PendingIntentFlags.OneShot);

				var notificationBuilder = new NotificationCompat.Builder(this, MainActivity.CHANNEL_ID)
										  .SetSmallIcon(Resource.Drawable.common_google_signin_btn_icon_light_normal)
										  .SetContentTitle("FCM Message")
										  .SetContentText(messageBody ?? "DATA ONLY")
										  .SetAutoCancel(true)
										  .SetContentIntent(pendingIntent);

				notificationManager.Notify(MainActivity.NOTIFICATION_ID, notificationBuilder.Build()); 
			}

Or start an activity. (Works only below Android 10):

var startActivityIntent = new Intent(this, typeof(MainActivity));
					startActivityIntent.SetAction("ACTION_VIEW");
					startActivityIntent.SetFlags(ActivityFlags.NewTask);

					StartActivity(startActivityIntent);
This content has 4 years. Some of the information in this post may be out of date or no longer work. Please, read this page keeping its age in your mind.

Android: Alkalmazás aláíró kulcs ujjlenyomatának megtekintése Windowson

Nyissunk egy ADB.exe-t.

Keressük meg a .apk kiterjesztésű fájlunkat, és csomagoljuk ki, mintha egy zip állomány lenne. Én a WinRaR programot használtam ehhez. Keressük ki a META/INF mappát, és ott lesz egy .RSA kiterjesztésű fájl. Másoljuk olyan helyre, ahonnan könnyen írhatunk elérési útvonalat hozzá.

Gépeljük az ADB-be a következőt:

keytool -printcert -file <elérési út / "C:\good.RSA">

A végeredmény valahogy így néz ki (Nem eltakarva az adatokat):

This content has 5 years. Some of the information in this post may be out of date or no longer work. Please, read this page keeping its age in your mind.

Xamarin Android: SplashScreenActivity létrehozása

Ahhoz, hogy legyen egy betöltő Activitynk, ami nem fehér képernyőt jelnít meg akkor amikor az applikáció először töltődik be, ahhozlétre kell hozni egy SplasActivity.cs-t az alábbiak alapján:

	[Activity(Label = "APPLICATIONNAME", Icon = "@drawable/android_app_icon", Theme = "@style/MainTheme.Splash", MainLauncher = true, NoHistory = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation, ScreenOrientation = ScreenOrientation.Portrait)]

	public class SplashActivity : AppCompatActivity
	{

		public override void OnCreate(Bundle savedInstanceState, PersistableBundle persistentState)
		{
			base.OnCreate(savedInstanceState, persistentState);

		}

		protected override void OnResume()
		{
			base.OnResume();

			var mainIntent = new Intent(Application.Context, typeof(MainActivity));

			if (Intent.Extras != null)
			{
				mainIntent.PutExtras(Intent.Extras);
			}
			mainIntent.SetFlags(ActivityFlags.SingleTop);
			StartActivity(mainIntent);
		}
	}

Az OnResume metódusban át kell adni az intenteket a MainActivitynk számára, hogy pl a Push üzenetek feldolgozásra kerüljenek. Ezekről itt ovlashatsz: https://www.banditoth.hu/2020/01/16/xamarin-android-splashscreenactivity-es-pushnotification-megnyitas-kilott-alkalmazasnal/

A MainActivity Activity attribútumát a következőképpen kell módosítani:

[Activity(Theme = "@style/MainTheme", MainLauncher = false, Exported = true,  ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation, ScreenOrientation = ScreenOrientation.Portrait,
        LaunchMode = LaunchMode.SingleTop)]

Ahogy láthatjuk, a SplashActivitynk az alábbi témát fogja használni: “Theme = “@style/MainTheme.Splash””, ezért létre kell hozni a styles.xml-ben egy új style-t az alábbi alapján:

<style name="MainTheme.Splash" parent ="Theme.AppCompat.Light.NoActionBar">
    <item name="android:windowBackground">@drawable/splash_screen</item>
    <item name="android:windowNoTitle">true</item>
    <item name="android:windowFullscreen">true</item>
    <item name="android:windowContentOverlay">@null</item>
    <item name="android:windowActionBar">true</item>
  </style>

Ez a téma háttérként a “@drawable/splash_screen” resource-t fogja használni, ezért ezt is létre kell hozni a drawable mappa alá az alábbi mintára:

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
  <item>
    <color android:color="@color/splash_background"/>
  </item>
  <item>
    <bitmap
        android:src="@drawable/icon"
        android:tileMode="disabled"
        android:gravity="center"/>
  </item>
</layer-list>

Az itt használt @color és @drawable iconok változhatnak, csak a bemutatás célját szolgálják.

https://docs.microsoft.com/en-us/xamarin/android/user-interface/splash-screen

This content has 5 years. Some of the information in this post may be out of date or no longer work. Please, read this page keeping its age in your mind.