2011-12-15 5 views
0

少し助けが必要です。これを短くする。私は一般的なライセンスのチェックコードをインストールしたが、私は市場に私のアプリを使用することを許可していない私のアプリをアップロードしたとき。誰かが私が見逃したことを私に見せることができるかどうかは彼らに許可がないことを伝えていますか?アンドロイドライセンスが動作しない

package com.test.test; 

    import android.app.Activity; 
    import android.app.AlertDialog; 
    import android.app.Dialog; 
    import android.content.DialogInterface; 
    import android.content.Intent; 
    import android.net.Uri; 
    import android.os.Bundle; 
    import android.provider.Settings.Secure; 
    import android.widget.Toast; 

    import com.manifestxml.chakra.AESObfuscator; 
    import com.manifestxml.chakra.LicenseChecker; 
    import com.manifestxml.chakra.LicenseCheckerCallback; 
    import com.manifestxml.chakra.ServerManagedPolicy; 



    public class splash extends Activity { 
    private class MyLicenseCheckerCallback implements LicenseCheckerCallback { 
     public void allow() { 
      if (isFinishing()) { 
       // Don't update UI if Activity is finishing. 
       return; 
      } 
      // Should allow user access. 
      startMainActivity(); 

     } 

     public void applicationError(ApplicationErrorCode errorCode) { 
      if (isFinishing()) { 
       // Don't update UI if Activity is finishing. 
       return; 
      } 
      // This is a polite way of saying the developer made a mistake 
      // while setting up or calling the license checker library. 
      // Please examine the error code and fix the error. 
      toast("Error: " + errorCode.name()); 
      startMainActivity(); 

     } 

     public void dontAllow() { 
      if (isFinishing()) { 
       // Don't update UI if Activity is finishing. 
       return; 
      } 

      // Should not allow access. In most cases, the app should assume 
      // the user has access unless it encounters this. If it does, 
      // the app should inform the user of their unlicensed ways 
      // and then either shut down the app or limit the user to a 
      // restricted set of features. 
      // In this example, we show a dialog that takes the user to Market. 
      showDialog(0); 
     } 
    } 
    private static final String BASE64_PUBLIC_KEY = "my key... sorry you cant see it"; 

    private static final byte[] SALT = new byte[] { salt numbers here }; 
    private LicenseChecker mChecker; 

    // A handler on the UI thread. 

    private LicenseCheckerCallback mLicenseCheckerCallback; 

    private void doCheck() { 

     mChecker.checkAccess(mLicenseCheckerCallback); 
    } 

    @Override 
    public void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 

     // Try to use more data here. ANDROID_ID is a single point of attack. 
     String deviceId = Secure.getString(getContentResolver(), 
       Secure.ANDROID_ID); 

     // Library calls this when it's done. 
     mLicenseCheckerCallback = new MyLicenseCheckerCallback(); 
     // Construct the LicenseChecker with a policy. 
     mChecker = new LicenseChecker(this, new ServerManagedPolicy(this, 
       new AESObfuscator(SALT, getPackageName(), deviceId)), 
       BASE64_PUBLIC_KEY); 
     doCheck(); 

    } 

    @Override 
    protected Dialog onCreateDialog(int id) { 
     // We have only one dialog. 
     return new AlertDialog.Builder(this) 
       .setTitle("Application Not Licensed") 
       .setCancelable(false) 
       .setMessage(
         "This app does not appear to be valid.  
    Please purchase it from Android Market. If this is an error, please contact the  
developer for a correction.") 
    .setPositiveButton("Purchase", 
         new DialogInterface.OnClickListener() { 
    public void onClick(DialogInterface dialog, 
     int which) { 
    Intent marketIntent = new Intent(
           Intent.ACTION_VIEW, 



    Uri.parse("http://market.android.com/details?id=" 
               + 

getPackageName())); 
           startActivity(marketIntent); 
           finish(); 
          } 
         }) 
       .setNegativeButton("Exit", 
         new DialogInterface.OnClickListener() { 
          public void onClick(DialogInterface dialog, 
            int which) { 
           finish(); 
          } 
         }).create(); 
    } 

    @Override 
    protected void onDestroy() { 
     super.onDestroy(); 
     mChecker.onDestroy(); 
    } 

    private void startMainActivity() { 
     startActivity(new Intent(this, ToggleButtonMain.class)); //REPLACE  
    MainActivity.class WITH YOUR 


    APPS ORIGINAL LAUNCH ACTIVITY 
     finish(); 
    } 

    public void toast(String string) { 
     Toast.makeText(this, string, Toast.LENGTH_SHORT).show(); 
    } 

} 

がここに誰かが助けることができる私のマニフェストファイル

<?xml version="1.0" encoding="utf-8"?> 

    <manifest xmlns:android="http://schemas.android.com/apk/res/android" 
     package="com.test.name" 
     android:versionName="1.6" android:versionCode="9"> 


<application android:icon="@drawable/icon" android:label="@string/app_name"> 
<activity android:name=".splash" android:theme="@android:style/Theme.Translucent.NoTitleBar"> 
<intent-filter> 
<action android:name="android.intent.action.MAIN" /> 
<category android:name="android.intent.category.LAUNCHER" /> 
</intent-filter> 
</activity>  


     <activity android:name = ".ToggleButtonMain"> 

</activity> 




     <activity android:label="@string/app_name" 
       android:name=".TimerActivity" 
> 
      <intent-filter> 
       <action android:name="android.intent.action.MAIN" /> 
       <category android:name="android.intent.category.DEFAULT" /> 
      </intent-filter> 
     </activity> 
     <activity android:label="Preferences" android:name=".TimerPrefActivity"> 
      <intent-filter> 
       <action android:name="android.intent.action.CATEGORY_PREFERENCE" /> 
      </intent-filter> 
     </activity> 


      <activity android:name = ".TabBarExample"> 
      <intent-filter> 
       <action android:name="android.intent.action.MAIN" /> 
       <category android:name="android.intent.category.DEFAULT" /> 
      </intent-filter> 
</activity> 


<activity android:name = "meditationmusic"> 
      <intent-filter> 
       <action android:name="android.intent.action.MAIN" /> 
       <category android:name="android.intent.category.DEFAULT" /> 
      </intent-filter> 
</activity> 


    <activity android:name=".FirstTab" /> 
    <activity android:name=".SecondTab" /> 
    <activity android:name=".thirdTab" /> 
    <activity android:name=".fourthTab" /> 
    <activity android:name=".fifthTab" /> 
    <activity android:name=".sixthTab" /> 
    <activity android:name=".seventhTab" /> 
    <activity android:name=".HowToOpen" /> 
    <activity android:name=".viztech" /> 
    <activity android:name=".viznotes" /> 
    <activity android:name=".cleanchakra" /> 
    <activity android:name=".breathing" /> 
    <activity android:name=".benefits" /> 




    <receiver android:name=".TimerReceiver" ></receiver> 
</application> 

    <uses-sdk android:minSdkVersion="3" /> 
     <uses-permission android:name="android.permission.VIBRATE" /> 
<uses-permission android:name="com.android.vending.CHECK_LICENSE"></uses-permission> 
<uses-permission android:name="android.permission.WAKE_LOCK"></uses-permission> 
</manifest> 

ているのですか?...私は見逃さなかったものを....事前に感謝します。

+0

あなた自身でバグを再作成しましたか? – ethan

+0

私はアップロードする前にすべてがうまく見えた..私は再びファイルを実行することができると思う..それは傷つきません。しかし、私のコードに問題はありますか?何か見落としていますか? – user474026

答えて

0

BASE64_PUBLIC_KEYがmarket.android.com/publishのものと正確に一致していることを確認してください(プロファイルを編集するにはここをクリックしてください)?

+0

はい開発者のプロフィールアカウントから公開鍵を取得しました。私はなぜこれが起こっているのか把握する必要があります。任意の考え...コードはきれいに見える? – user474026