add psm uid

This commit is contained in:
Li 2023-11-06 13:25:23 +13:00
parent ce5d1f801d
commit f0ac4238ff
6 changed files with 47 additions and 18 deletions

1
.gitignore vendored
View File

@ -9,6 +9,7 @@
/.idea/assetWizardSettings.xml /.idea/assetWizardSettings.xml
.DS_Store .DS_Store
/build /build
/app/build/*
/captures /captures
.externalNativeBuild .externalNativeBuild
.cxx .cxx

View File

@ -1 +0,0 @@
My Application

View File

@ -1,11 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="GradleMigrationSettings" migrationVersion="1" />
<component name="GradleSettings"> <component name="GradleSettings">
<option name="linkedExternalProjectsSettings"> <option name="linkedExternalProjectsSettings">
<GradleProjectSettings> <GradleProjectSettings>
<option name="testRunner" value="GRADLE" /> <option name="testRunner" value="GRADLE" />
<option name="distributionType" value="DEFAULT_WRAPPED" /> <option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" /> <option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleJvm" value="jbr-17" />
<option name="modules"> <option name="modules">
<set> <set>
<option value="$PROJECT_DIR$" /> <option value="$PROJECT_DIR$" />

View File

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" /> <component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" project-jdk-name="jbr-17" project-jdk-type="JavaSDK"> <component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="jbr-17" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" /> <output url="file://$PROJECT_DIR$/build/classes" />
</component> </component>
<component name="ProjectType"> <component name="ProjectType">
<option name="id" value="Android" /> <option name="id" value="Android" />
</component> </component>
</project> </project>

View File

@ -1,11 +1,11 @@
package pink.yuv.android_id; package pink.yuv.android_id;
import android.app.Activity; import android.app.Activity;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.os.Bundle; import android.os.Bundle;
import android.os.PersistableBundle; import android.provider.Settings.Secure;
import android.provider.Settings;
import android.widget.TextView; import android.widget.TextView;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
public class MainActivity extends Activity { public class MainActivity extends Activity {
@ -14,9 +14,22 @@ public class MainActivity extends Activity {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main); setContentView(R.layout.activity_main);
TextView androidIdTextView = (TextView)findViewById(R.id.textView); TextView androidIdTextView = (TextView)findViewById(R.id.androidId);
String android_id = Settings.Secure.getString(getContentResolver(), Settings.Secure.ANDROID_ID); String android_id = Secure.getString(getContentResolver(), Secure.ANDROID_ID);
System.out.println("android_id: "+android_id); System.out.println("android_id: "+android_id);
androidIdTextView.setText("android_id: "+android_id); androidIdTextView.setText("android_id: "+android_id);
String psmAppId = "app not installed";
try{
ApplicationInfo psmAppInfo = this.getApplicationContext().getPackageManager().getApplicationInfo("com.playstation.psstore", 0);
if(psmAppInfo != null)
psmAppId = String.valueOf(psmAppInfo.uid);
}
catch (PackageManager.NameNotFoundException e) { };
TextView psmAppIdTextView = (TextView)findViewById(R.id.psmAppId);
System.out.println("psstore_uid: "+psmAppId);
psmAppIdTextView.setText("psstore_uid: "+psmAppId);
} }
} }

View File

@ -1,12 +1,26 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" > android:layout_height="match_parent"
android:paddingTop="8dp"
android:paddingBottom="8dp"
android:orientation="vertical">
<TextView <TextView
android:id="@+id/textView" android:id="@+id/androidId"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textColor="@color/white" android:textColor="@color/white"
android:textSize="20sp" /> android:textSize="20sp"
android:text="android_id: "/>
<TextView
android:id="@+id/psmAppId"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/androidId"
android:textColor="@color/white"
android:textSize="20sp"
android:text="psstore_uid: "/>
</RelativeLayout> </RelativeLayout>