ç¡æã¢ããªã¨ææã¢ããªã®ããã¸ã§ã¯ãã管çãã
ã¢ããªãä½ã£ãæã«ç¡æã¢ããªã¨ææã¢ããªã¨ï¼ãã¼ã¸ã§ã³ä½ãäºã£ã¦ããããã¨æãã¾ãã
ç¡æã¢ããªã¨ææã¢ããªã«åãããå ´åãããã±ã¼ã¸åãå¤ããªãã¨ãããªãã®ã§ããã¸ã§ã¯ããï¼ã¤ç«ã¦ãå¿
è¦ãããã¾ãã
ãã®å ´åãã½ã¼ã¹ãï¼é管çã«ãªã£ã¦ãã¾ãããªãªã¼ã¹å¾ã®æ¹ä¿®ãé常ã«ããã©ãã ããã§ãã
ããã¯ãã³ç¾ã®ãã¼ã¸ã§ã³ã¢ããã§ã ãã¶è¦ããããã¾ããâ¦ã
ããã楽ã«ãããã¨èãã¦æ¹æ³ãèãã¾ããã
ããã¸ã§ã¯ãä½ã
Androidã©ã¤ãã©ãªã使ãã¨ã½ã¼ã¹ãï¼ã¤ã«ãªãã管çã楽ã«ãªãã¾ãã
ããã¸ã§ã¯ãã¯åè¨ï¼ã¤ä½ãã¾ãã
æ¹é
AndroidAppCodeã«ãã¹ã¦ã®ã³ã¼ããæ¸ãã¾ãã
AndroidPayAppã¨AndroidFreeAppã®ï¼ã¤ã®ã¢ããªã¯AndroidAppCoreãåç
§ãã¾ãã
AndroidPayAppã¨AndroidFreeAppã®ï¼ã¤ã®ããã¸ã§ã¯ãã«ã¯ä¸åã½ã¼ã¹ã¯ç½®ãã¾ããã
AndroidManifest.xml
AndroidPayAppã¨AndroidFreeAppã®AndroidManifestã«ã¯AndroidAppCoreã®Activityã®å®ç¾©ãæ¸ãã¾ãã
ä»åã¯ï¼ã¤ã®Activityã®ã¿ãªã®ã§ä»¥ä¸ã®ããã«ãªãã¾ãã
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="jp.tomorrowkey.android.androidpayapp" android:versionCode="1" android:versionName="1.0"> <application android:icon="@drawable/icon" android:label="@string/app_name"> <activity android:name="jp.tomorrowkey.android.androidlib.MainActivity"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> <uses-sdk android:minSdkVersion="4" /> </manifest>
æ²è¼ããã®ã¯AndroidPayAppã®AndroidManifestã§ãã
AndroidFreeAppã®AndroidManifestã¯ã»ã¼ä¸ç·ãªã®ã§è¼ãã¾ããã
ããã§ã¢ããªããã©ã¤ãã©ãªã«å®ç¾©ããã¦ããActivityãå¼ã³åºãã¾ãã
ç¡æã¢ããªã¨ææã¢ããªã®å¤æ
ç¡æã¢ããªã¯æ©è½ã«å¶éãããããªãã¨ãããªãã®ã§ãç¡æã¢ããªã¨ææã¢ããªã®å¤æãããã³ã¼ããå¿
è¦ã§ãã
Context#getPackageName()ã§ææã¢ããªãç¡æã¢ããªããããã®ããã±ã¼ã¸åãè¿ã£ã¦ããã®ã§ããã§å¤æãã¾ãã
Utilã¯ã©ã¹ã§ãä½ã£ã¦ããã¾ãããã
import android.content.Context; public class Util { private static final String PAY_APP_PACKAGE_NAME = "jp.tomorrowkey.android.androidpayapp"; public static boolean isPaymentApp(Context context) { String packageName = context.getPackageName(); return PAY_APP_PACKAGE_NAME.equals(packageName); } }
åä½
ã¢ã¤ã³ã³ã¨ã¢ããªåã¯AndroidManifestã«ããããå®ç¾©ããã®ã§
ç¡æã¢ããªã¨ææã¢ããªã§å¥ã®ãã®ã使ç¨ãããã¨ãã§ãã¾ãã
ä»åã¯ç¡æã¢ããªã«ã°ã¬ã¼ã®ã¢ã¤ã³ã³ããææã¢ããªã«ç·è²ã®ã¢ã¤ã³ã³ã使ãã¾ããã
ããããã®ã¢ããªãå®è¡ãã¾ããã
ããã±ã¼ã¸åããç¡æçã»ææçã®å¤æããã¦ããããã®æååãåºåãã¦ãã¾ãã
ãµã³ãã«ã½ã¼ã¹
ä»åæ¤è¨¼ç¨ã«ä½ã£ãã½ã¼ã¹ã¯ããã«ããã¾ã
http://code.google.com/p/tomorrowkey/source/browse/#svn/trunk/FreeAndPaymentSourceControl
ããã§
ããªã管çã楽ã«ï¼
ããä½ãèããªãã¦ããããï¼