差分
ナビゲーションに移動
検索に移動
アプリ固有のIDを生成して保存しておく。
この方法だと再インストールするとIDは変わる。
[[リセマラ]]対応[[ゲーム]]などを作るときはこれ。
<source>
public class Installation
{
public static string _uuid;
public const string INSTALLATION = "INSTALLATION";
public static string GetUUID(Context context)
{
if (_uuid == null)
{
var installationFilePath = Path.Combine(context.FilesDir.AbsolutePath, INSTALLATION);
if (!File.Exists(installationFilePath))
{
_uuid = Java.Util.UUID.RandomUUID().ToString();
File.WriteAllText(installationFilePath, _uuid);
}
_uuid = File.ReadAllText(installationFilePath);
}
return _uuid;
}
}
</source>
== 関連項目 ==
* [[Xamarin.AndroidでAndroid IDを取得する]]
[[category: Xamarin.Android]]
この方法だと再インストールするとIDは変わる。
[[リセマラ]]対応[[ゲーム]]などを作るときはこれ。
<source>
public class Installation
{
public static string _uuid;
public const string INSTALLATION = "INSTALLATION";
public static string GetUUID(Context context)
{
if (_uuid == null)
{
var installationFilePath = Path.Combine(context.FilesDir.AbsolutePath, INSTALLATION);
if (!File.Exists(installationFilePath))
{
_uuid = Java.Util.UUID.RandomUUID().ToString();
File.WriteAllText(installationFilePath, _uuid);
}
_uuid = File.ReadAllText(installationFilePath);
}
return _uuid;
}
}
</source>
== 関連項目 ==
* [[Xamarin.AndroidでAndroid IDを取得する]]
[[category: Xamarin.Android]]